]> source.dussan.org Git - jquery.git/commitdiff
Revert "Data: do not include digits when camelCasing"
authorOleg Gaidarenko <markelog@gmail.com>
Tue, 22 Dec 2015 13:45:05 +0000 (16:45 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 22 Dec 2015 13:45:05 +0000 (16:45 +0300)
This reverts commit a254f22d7bb5b072a82087a448130ffadd70d698.

src/core.js
test/unit/core.js
test/unit/data.js

index 6ba437662b4c7e8f498e28ed20985b8638d04766..46c69b6c1797b760c1956fb103f6105fb36e7f3c 100644 (file)
@@ -29,7 +29,7 @@ var
 
        // 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 ) {
index d1e618c8b081ef6223261aa11fbeffdbdae3c474..472c4b5aff38ca338bd03b4f8f2c74cfe5c06f82 100644 (file)
@@ -1648,7 +1648,7 @@ QUnit.test( "jQuery.camelCase()", function( assert ) {
                "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"
index 91002b8a055b6cac78fd87cad39b0d17aae069c1..c402e20bbd9d2af9b3e3e5fa364788fd0db3ff86 100644 (file)
@@ -373,51 +373,30 @@ QUnit.test( "jQuery(plain Object).data(String, Object).data(String)", function(
 } );
 
 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"
-       );
+       equal( div.data("attr"), undefined, "Check for non-existing data-attr attribute" );
 
-       div.attr( "data-attr", "exists" );
-       assert.equal(
-               div.data( "attr" ), "exists", "Check for existing data-attr attribute"
-       );
+       div.attr("data-attr", "exists");
+       equal( div.data("attr"), "exists", "Check for existing data-attr attribute" );
 
-       div.attr( "data-attr", "exists2" );
-       assert.equal(
-               div.data( "attr" ), "exists", "Check that updates to data- don't update .data()"
-       );
+       div.attr("data-attr", "exists2");
+       equal( div.data("attr"), "exists", "Check that updates to data- don't update .data()" );
 
-       div.data( "attr", "internal" ).attr( "data-attr", "external" );
-       assert.equal(
-               div.data( "attr" ),
-               "internal",
-               "Check for .data('attr') precedence (internal > external data-* attribute)"
-       );
+       div.data("attr", "internal").attr("data-attr", "external");
+       equal( div.data("attr"), "internal", "Check for .data('attr') precedence (internal > external data-* 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");
+       equal( child.data("myobj"), "old data", "Value accessed from data-* attribute");
 
        child.data( "myobj", "replaced" );
        assert.equal(
@@ -431,7 +410,7 @@ QUnit.test( "data-* attributes", function( assert ) {
 
        obj = child.data();
        obj2 = dummy.data();
-       check = [ "myobj", "ignored", "other", "foo-42" ];
+       check = [ "myobj", "ignored", "other" ];
        num = 0;
        num2 = 0;