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
a38a5cd5
Commit
a38a5cd5
authored
Jul 16, 2009
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery core: Simplifying isEmptyObject() and adding tests.
parent
991d039b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
core.js
src/core.js
+3
-3
core.js
test/unit/core.js
+10
-0
No files found.
src/core.js
View file @
a38a5cd5
...
@@ -292,9 +292,9 @@ jQuery.extend({
...
@@ -292,9 +292,9 @@ jQuery.extend({
},
},
isEmptyObject
:
function
(
obj
)
{
isEmptyObject
:
function
(
obj
)
{
var
name
=
""
;
for
(
var
name
in
obj
)
for
(
name
in
obj
)
break
;
return
false
;
return
!
nam
e
;
return
tru
e
;
},
},
// check if an element is in a (or is an) XML document
// check if an element is in a (or is an) XML document
...
...
test/unit/core.js
View file @
a38a5cd5
...
@@ -599,3 +599,13 @@ test("jQuery.makeArray", function(){
...
@@ -599,3 +599,13 @@ test("jQuery.makeArray", function(){
ok
(
jQuery
.
makeArray
(
document
.
getElementById
(
'form'
)).
length
>=
13
,
"Pass makeArray a form (treat as elements)"
);
ok
(
jQuery
.
makeArray
(
document
.
getElementById
(
'form'
)).
length
>=
13
,
"Pass makeArray a form (treat as elements)"
);
});
});
test
(
"jQuery.isEmptyObject"
,
function
(){
expect
(
2
);
equals
(
true
,
jQuery
.
isEmptyObject
({}),
"isEmptyObject on empty object literal"
);
equals
(
false
,
jQuery
.
isEmptyObject
({
a
:
1
}),
"isEmptyObject on non-empty object literal"
);
// What about this ?
// equals(true, jQuery.isEmptyObject(null), "isEmptyObject on null" );
});
\ No newline at end of file
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