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
35c68b45
Commit
35c68b45
authored
May 02, 2008
by
Scott González
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: Fixed #2600: jQuery.extend no longer skips over null properties.
parent
87758bbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+12
-2
No files found.
src/core.js
View file @
35c68b45
...
...
@@ -587,7 +587,7 @@ jQuery.extend = jQuery.fn.extend = function() {
target
[
name
]
=
jQuery
.
extend
(
deep
,
src
,
copy
);
// Don't bring in undefined values
else
if
(
copy
!=
undefined
)
else
if
(
copy
!=
=
undefined
)
target
[
name
]
=
copy
;
}
...
...
test/unit/core.js
View file @
35c68b45
...
...
@@ -1025,7 +1025,7 @@ test("is(String)", function() {
});
test
(
"$.extend(Object, Object)"
,
function
()
{
expect
(
17
);
expect
(
20
);
var
settings
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
options
=
{
xnumber2
:
1
,
xstring2
:
"x"
,
xxx
:
"newstring"
},
...
...
@@ -1049,7 +1049,17 @@ test("$.extend(Object, Object)", function() {
isObj
(
deep1
.
foo
,
deepmerged
.
foo
,
"Check if foo: settings must be extended"
);
isObj
(
deep2
.
foo
,
deep2copy
.
foo
,
"Check if not deep2: options must not be modified"
);
equals
(
deep1
.
foo2
,
document
,
"Make sure that a deep clone was not attempted on the document"
);
var
nullUndef
;
nullUndef
=
jQuery
.
extend
({},
options
,
{
xnumber2
:
null
});
ok
(
nullUndef
.
xnumber2
===
null
,
"Check to make sure null values are copied"
);
nullUndef
=
jQuery
.
extend
({},
options
,
{
xnumber2
:
undefined
});
ok
(
nullUndef
.
xnumber2
===
options
.
xnumber2
,
"Check to make sure undefined values are not copied"
);
nullUndef
=
jQuery
.
extend
({},
options
,
{
xnumber0
:
null
});
ok
(
nullUndef
.
xnumber0
===
null
,
"Check to make sure null values are inserted"
);
var
target
=
{};
var
recursive
=
{
foo
:
target
,
bar
:
5
};
jQuery
.
extend
(
true
,
target
,
recursive
);
...
...
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