Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
a254f22d
Commit
a254f22d
authored
May 03, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data: do not include digits when camelCasing
Fixes gh-1751
parent
49bce471
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+1
-1
data.js
test/unit/data.js
+5
-4
No files found.
src/core.js
View file @
a254f22d
...
@@ -26,7 +26,7 @@ var
...
@@ -26,7 +26,7 @@ var
// Matches dashed string for camelizing
// Matches dashed string for camelizing
rmsPrefix
=
/^-ms-/
,
rmsPrefix
=
/^-ms-/
,
rdashAlpha
=
/-
([
\d
a-z
])
/gi
,
rdashAlpha
=
/-
([
a-z
])
/gi
,
// Used by jQuery.camelCase as callback to replace()
// Used by jQuery.camelCase as callback to replace()
fcamelCase
=
function
(
all
,
letter
)
{
fcamelCase
=
function
(
all
,
letter
)
{
...
...
test/unit/core.js
View file @
a254f22d
...
@@ -1484,7 +1484,7 @@ test("jQuery.camelCase()", function() {
...
@@ -1484,7 +1484,7 @@ test("jQuery.camelCase()", function() {
"foo-bar"
:
"fooBar"
,
"foo-bar"
:
"fooBar"
,
"foo-bar-baz"
:
"fooBarBaz"
,
"foo-bar-baz"
:
"fooBarBaz"
,
"girl-u-want"
:
"girlUWant"
,
"girl-u-want"
:
"girlUWant"
,
"the-4th-dimension"
:
"the4thDimension"
,
"the-4th-dimension"
:
"the
-
4thDimension"
,
"-o-tannenbaum"
:
"OTannenbaum"
,
"-o-tannenbaum"
:
"OTannenbaum"
,
"-moz-illa"
:
"MozIlla"
,
"-moz-illa"
:
"MozIlla"
,
"-ms-take"
:
"msTake"
"-ms-take"
:
"msTake"
...
...
test/unit/data.js
View file @
a254f22d
...
@@ -241,14 +241,14 @@ test("jQuery(plain Object).data(String, Object).data(String)", function() {
...
@@ -241,14 +241,14 @@ test("jQuery(plain Object).data(String, Object).data(String)", function() {
});
});
test
(
"data-* attributes"
,
function
()
{
test
(
"data-* attributes"
,
function
()
{
expect
(
4
3
);
expect
(
4
6
);
var
prop
,
i
,
l
,
metadata
,
elem
,
var
prop
,
i
,
l
,
metadata
,
elem
,
obj
,
obj2
,
check
,
num
,
num2
,
obj
,
obj2
,
check
,
num
,
num2
,
parseJSON
=
jQuery
.
parseJSON
,
parseJSON
=
jQuery
.
parseJSON
,
div
=
jQuery
(
"<div>"
),
div
=
jQuery
(
"<div>"
),
child
=
jQuery
(
"<div data-myobj='old data' data-ignored=
\"
DOM
\"
data-other='test'></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'></div>"
);
dummy
=
jQuery
(
"<div data-myobj='old data' data-ignored=
\"
DOM
\"
data-other='test'
data-foo-42='boosh'
></div>"
);
equal
(
div
.
data
(
"attr"
),
undefined
,
"Check for non-existing data-attr attribute"
);
equal
(
div
.
data
(
"attr"
),
undefined
,
"Check for non-existing data-attr attribute"
);
...
@@ -265,6 +265,7 @@ test("data-* attributes", function() {
...
@@ -265,6 +265,7 @@ test("data-* attributes", function() {
child
.
appendTo
(
"#qunit-fixture"
);
child
.
appendTo
(
"#qunit-fixture"
);
equal
(
child
.
data
(
"myobj"
),
"old data"
,
"Value accessed from data-* attribute"
);
equal
(
child
.
data
(
"myobj"
),
"old data"
,
"Value accessed from data-* attribute"
);
equal
(
child
.
data
(
"foo-42"
),
"boosh"
,
"camelCasing does not affect numbers (#1751)"
);
child
.
data
(
"myobj"
,
"replaced"
);
child
.
data
(
"myobj"
,
"replaced"
);
equal
(
child
.
data
(
"myobj"
),
"replaced"
,
"Original data overwritten"
);
equal
(
child
.
data
(
"myobj"
),
"replaced"
,
"Original data overwritten"
);
...
@@ -274,7 +275,7 @@ test("data-* attributes", function() {
...
@@ -274,7 +275,7 @@ test("data-* attributes", function() {
obj
=
child
.
data
();
obj
=
child
.
data
();
obj2
=
dummy
.
data
();
obj2
=
dummy
.
data
();
check
=
[
"myobj"
,
"ignored"
,
"other"
];
check
=
[
"myobj"
,
"ignored"
,
"other"
,
"foo-42"
];
num
=
0
;
num
=
0
;
num2
=
0
;
num2
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment