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
515efbdc
Commit
515efbdc
authored
Sep 24, 2010
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that undefined is always returned for missing data properties. Follow-up to #6304.
parent
76db8a98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
data.js
test/unit/data.js
+4
-1
No files found.
test/unit/data.js
View file @
515efbdc
...
@@ -81,11 +81,14 @@ test("jQuery.data", function() {
...
@@ -81,11 +81,14 @@ test("jQuery.data", function() {
});
});
test
(
".data()"
,
function
()
{
test
(
".data()"
,
function
()
{
expect
(
2
);
expect
(
4
);
var
div
=
jQuery
(
"#foo"
);
var
div
=
jQuery
(
"#foo"
);
strictEqual
(
div
.
data
(
"foo"
),
undefined
,
"Make sure that missing result is undefined"
);
div
.
data
(
"test"
,
"success"
);
div
.
data
(
"test"
,
"success"
);
same
(
div
.
data
(),
{
test
:
"success"
},
"data() get the entire data object"
);
same
(
div
.
data
(),
{
test
:
"success"
},
"data() get the entire data object"
);
strictEqual
(
div
.
data
(
"foo"
),
undefined
,
"Make sure that missing result is still undefined"
);
var
nodiv
=
jQuery
(
"#unfound"
);
var
nodiv
=
jQuery
(
"#unfound"
);
equals
(
nodiv
.
data
(),
null
,
"data() on empty set returns null"
);
equals
(
nodiv
.
data
(),
null
,
"data() on empty set returns null"
);
...
...
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