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
ad3c49d1
Commit
ad3c49d1
authored
May 03, 2008
by
Scott González
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: Fixed #2605: .data() now accepts null as a value.
parent
35c68b45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+5
-1
No files found.
src/core.js
View file @
ad3c49d1
...
@@ -669,7 +669,7 @@ jQuery.extend({
...
@@ -669,7 +669,7 @@ jQuery.extend({
jQuery
.
cache
[
id
]
=
{};
jQuery
.
cache
[
id
]
=
{};
// Prevent overriding the named cache with undefined values
// Prevent overriding the named cache with undefined values
if
(
data
!=
undefined
)
if
(
data
!=
=
undefined
)
jQuery
.
cache
[
id
][
name
]
=
data
;
jQuery
.
cache
[
id
][
name
]
=
data
;
// Return the named cache data, or the ID for the element
// Return the named cache data, or the ID for the element
...
...
test/unit/core.js
View file @
ad3c49d1
...
@@ -1398,13 +1398,17 @@ test("$.className", function() {
...
@@ -1398,13 +1398,17 @@ test("$.className", function() {
});
});
test
(
"$.data"
,
function
()
{
test
(
"$.data"
,
function
()
{
expect
(
3
);
expect
(
5
);
var
div
=
$
(
"#foo"
)[
0
];
var
div
=
$
(
"#foo"
)[
0
];
ok
(
jQuery
.
data
(
div
,
"test"
)
==
undefined
,
"Check for no data exists"
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
undefined
,
"Check for no data exists"
);
jQuery
.
data
(
div
,
"test"
,
"success"
);
jQuery
.
data
(
div
,
"test"
,
"success"
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
"success"
,
"Check for added data"
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
"success"
,
"Check for added data"
);
jQuery
.
data
(
div
,
"test"
,
"overwritten"
);
jQuery
.
data
(
div
,
"test"
,
"overwritten"
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
"overwritten"
,
"Check for overwritten data"
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
"overwritten"
,
"Check for overwritten data"
);
jQuery
.
data
(
div
,
"test"
,
undefined
);
ok
(
jQuery
.
data
(
div
,
"test"
)
==
"overwritten"
,
"Check that data wasn't removed"
);
jQuery
.
data
(
div
,
"test"
,
null
);
ok
(
jQuery
.
data
(
div
,
"test"
)
===
null
,
"Check for null data"
);
});
});
test
(
".data()"
,
function
()
{
test
(
".data()"
,
function
()
{
...
...
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