0.0.2 • Published 7 years ago

attributor v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Attributor

A quick way to visually see all an attribute/content of the DOM elements in your page.

Installation

npm install -S attributor

Documentation

new Attributor(selector, attributeCallback)
NameTypeDescription
selectorStringSelector for elements to be checked
attributeCallbackFunctionCallback to select the attribute to be surfaced, given an element

Example

See example of usage for debugging here on Codepen.

If you want to see the class values for all p elements:

var Attributor = require('attributor');
var att = new Attributor('p', function(el){return el.getAttribute('class')});

If you want to see the innerHTML values for all elements with alert class:

var Attributor = require('attributor');
var att = new Attributor('.alert', function(el){ return el.innerHTML});