// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
- rdashAlpha = /-([a-z])/gi,
+ rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
"foo-bar": "fooBar",
"foo-bar-baz": "fooBarBaz",
"girl-u-want": "girlUWant",
- "the-4th-dimension": "the-4thDimension",
+ "the-4th-dimension": "the4thDimension",
"-o-tannenbaum": "OTannenbaum",
"-moz-illa": "MozIlla",
"-ms-take": "msTake"
} );
QUnit.test( "data-* attributes", function( assert ) {
- assert.expect( 46 );
+ assert.expect( 43 );
var prop, i, l, metadata, elem,
obj, obj2, check, num, num2,
parseJSON = jQuery.parseJSON,
- div = jQuery( "<div>" ),
- child = jQuery( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test' data-foo-42='boosh'></div>" ),
- dummy = jQuery( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test' data-foo-42='boosh'></div>" );
+ div = jQuery("<div>"),
+ child = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>"),
+ dummy = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>");
assert.equal( div.data( "attr" ), undefined, "Check for non-existing data-attr attribute" );
div.remove();
- child.appendTo( "#qunit-fixture" );
- assert.equal( child.data( "myobj" ), "old data", "Value accessed from data-* attribute" );
- assert.equal( child.data( "foo-42" ), "boosh", "camelCasing does not affect numbers (#1751)" );
+ child.appendTo("#qunit-fixture");
+ assert.equal( child.data("myobj"), "old data", "Value accessed from data-* attribute");
child.data( "myobj", "replaced" );
assert.equal( child.data( "myobj" ), "replaced", "Original data overwritten" );
obj = child.data();
obj2 = dummy.data();
- check = [ "myobj", "ignored", "other", "foo-42" ];
+ check = [ "myobj", "ignored", "other" ];
num = 0;
num2 = 0;