From 4f79b76deb05d20962db90a69f7ce9f7076add59 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Fri, 13 Nov 2015 15:18:49 +0300 Subject: [PATCH] Revert "Data: do not include digits when camelCasing" This reverts commit 2862a07af640be42711f72ad4abe532349985824. --- src/core.js | 2 +- test/unit/core.js | 2 +- test/unit/data.js | 15 +++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core.js b/src/core.js index 0adb67063..771a30f80 100644 --- a/src/core.js +++ b/src/core.js @@ -28,7 +28,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 ) { diff --git a/test/unit/core.js b/test/unit/core.js index a6de5bdae..1faf293b0 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1658,7 +1658,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" diff --git a/test/unit/data.js b/test/unit/data.js index fdd54629d..a33322365 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -273,14 +273,14 @@ QUnit.test( ".data(object) does not retain references. #13815", function( assert } ); 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( "
" ), - child = jQuery( "
" ), - dummy = jQuery( "
" ); + div = jQuery("
"), + child = jQuery("
"), + dummy = jQuery("
"); assert.equal( div.data( "attr" ), undefined, "Check for non-existing data-attr attribute" ); @@ -295,9 +295,8 @@ QUnit.test( "data-* attributes", function( assert ) { 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" ); @@ -307,7 +306,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; -- 2.39.5