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
cf16f860
Commit
cf16f860
authored
May 04, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data: camelCasing should not ignore case
Fixes gh-2070
parent
0204c308
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
core.js
src/core.js
+1
-1
data.js
test/unit/data.js
+10
-0
No files found.
src/core.js
View file @
cf16f860
...
@@ -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
=
/-
([
a-z
])
/g
i
,
rdashAlpha
=
/-
([
a-z
])
/g
,
// 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/data.js
View file @
cf16f860
...
@@ -592,6 +592,16 @@ test(".data always sets data with the camelCased key (gh-2257)", function() {
...
@@ -592,6 +592,16 @@ test(".data always sets data with the camelCased key (gh-2257)", function() {
});
});
});
});
test
(
".data should not strip more than one hyphen when camelCasing (gh-2070)"
,
function
()
{
expect
(
3
);
var
div
=
jQuery
(
"<div data-nested-single='single' data-nested--double='double' data-nested---triple='triple'></div>"
).
appendTo
(
"#qunit-fixture"
),
allData
=
div
.
data
();
equal
(
allData
.
nestedSingle
,
"single"
,
"Key is correctly camelCased"
);
equal
(
allData
[
"nested-Double"
],
"double"
,
"Key with double hyphens is correctly camelCased"
);
equal
(
allData
[
"nested--Triple"
],
"triple"
,
"Key with triple hyphens is correctly camelCased"
);
});
test
(
".data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values"
,
function
()
{
test
(
".data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values"
,
function
()
{
var
div
=
jQuery
(
"<div/>"
,
{
id
:
"hyphened"
}).
appendTo
(
"#qunit-fixture"
),
var
div
=
jQuery
(
"<div/>"
,
{
id
:
"hyphened"
}).
appendTo
(
"#qunit-fixture"
),
datas
=
{
datas
=
{
...
...
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