Chrome emits the following warning:
> 'Attr.nodeValue' is deprecated. Please use 'value' instead.
Attr.nodeName and nodeValue are not part of the DOM standard.
https://dom.spec.whatwg.org/#interface-attr
Attr.name and Attr.value are supported since at least IE8.
Confirmed the unit tests passing in IE8.
Simplify and improve the unit tests for jquery.getAttrs.
Change-Id: Ic086ece34b214dede26371cbc03ede0f2af37c54
len = map.length;
for ( i = 0; i < len; i++ ) {
len = map.length;
for ( i = 0; i < len; i++ ) {
- attrs[ map[i].nodeName ] = map[i].nodeValue;
+ attrs[ map[i].name ] = map[i].value;
( function ( $ ) {
QUnit.module( 'jquery.getAttrs', QUnit.newMwEnvironment() );
( function ( $ ) {
QUnit.module( 'jquery.getAttrs', QUnit.newMwEnvironment() );
- QUnit.test( 'Check', 1, function ( assert ) {
+ QUnit.test( 'getAttrs()', 1, function ( assert ) {
var attrs = {
foo: 'bar',
var attrs = {
foo: 'bar',
+ 'class': 'lorem',
+ 'data-foo': 'data value'
},
$el = $( '<div>' ).attr( attrs );
},
$el = $( '<div>' ).attr( attrs );
- assert.deepEqual( $el.getAttrs(), attrs, 'getAttrs() return object should match the attributes set, no more, no less' );
+ assert.propEqual( $el.getAttrs(), attrs, 'keys and values match' );