ampersand-dom
Advanced tools
Comparing version 1.2.7 to 1.3.0
@@ -65,2 +65,5 @@ /*$AMPERSAND_VERSION*/ | ||
}, | ||
hasAttribute: function (el, attr) { | ||
return el.hasAttribute(attr); | ||
}, | ||
hide: function (el) { | ||
@@ -67,0 +70,0 @@ if (!isHidden(el)) { |
{ | ||
"name": "ampersand-dom", | ||
"description": "Super light-weight DOM manipulation lib.", | ||
"version": "1.2.7", | ||
"version": "1.3.0", | ||
"author": "'Henrik Joreteg' <henrik@andyet.net>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -46,2 +46,5 @@ # ampersand-dom | ||
// returns true if that the element has an attribute with that name | ||
dom.hasAttribute(el, 'checked'); // => true | ||
// completely removes attribute | ||
@@ -56,3 +59,3 @@ dom.removeAttribute(el, 'checked'); | ||
// shows element, trying to determine it's default display state | ||
// shows element, trying to determine its default display state | ||
// based on tagname and getComputedStyle() | ||
@@ -59,0 +62,0 @@ dom.show(el); |
@@ -186,2 +186,30 @@ var suite = require('tape-suite'); | ||
}); | ||
s.test('has attribute', function (t) { | ||
t.notOk(dom.hasAttribute(fixture, 'foo')); | ||
dom.setAttribute(fixture, 'foo', 'bar'); | ||
t.ok(dom.hasAttribute(fixture, 'foo')); | ||
dom.removeAttribute(fixture, 'foo'); | ||
t.notOk(dom.hasAttribute(fixture, 'foo')); | ||
t.end(); | ||
}); | ||
s.test('has boolean attribute', function (t) { | ||
var input = document.createElement('input'); | ||
input.setAttribute('type', 'checkbox'); | ||
fixture.appendChild(input); | ||
t.notOk(dom.hasAttribute(fixture, 'checked')); | ||
dom.addAttribute(input, 'foo'); | ||
t.ok(dom.hasAttribute(input, 'foo')); | ||
dom.removeAttribute(input, 'foo'); | ||
t.notOk(dom.hasAttribute(input, 'foo')); | ||
t.end(); | ||
}); | ||
}); | ||
@@ -188,0 +216,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15782
7
326
74