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
95c02654
Commit
95c02654
authored
Nov 28, 2007
by
David Serduke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #1908 by testing to make sure it isn't null before checking the nodeType.
parent
ed7608d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
core.js
src/core.js
+2
-2
core.js
test/unit/core.js
+4
-1
No files found.
src/core.js
View file @
95c02654
...
@@ -549,11 +549,11 @@ jQuery.extend = jQuery.fn.extend = function() {
...
@@ -549,11 +549,11 @@ jQuery.extend = jQuery.fn.extend = function() {
continue
;
continue
;
// Recurse if we're merging object values
// Recurse if we're merging object values
if
(
deep
&&
typeof
options
[
name
]
==
"object"
&&
target
[
name
]
&&
!
options
[
name
].
nodeType
)
if
(
deep
&&
options
[
name
]
&&
typeof
options
[
name
]
==
"object"
&&
target
[
name
]
&&
!
options
[
name
].
nodeType
)
target
[
name
]
=
jQuery
.
extend
(
target
[
name
],
options
[
name
]
);
target
[
name
]
=
jQuery
.
extend
(
target
[
name
],
options
[
name
]
);
// Don't bring in undefined values
// Don't bring in undefined values
else
if
(
options
[
name
]
!=
undefined
)
else
if
(
options
[
name
]
!=
=
undefined
)
target
[
name
]
=
options
[
name
];
target
[
name
]
=
options
[
name
];
}
}
...
...
test/unit/core.js
View file @
95c02654
...
@@ -837,7 +837,7 @@ test("is(String)", function() {
...
@@ -837,7 +837,7 @@ test("is(String)", function() {
});
});
test
(
"$.extend(Object, Object)"
,
function
()
{
test
(
"$.extend(Object, Object)"
,
function
()
{
expect
(
1
4
);
expect
(
1
5
);
var
settings
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
var
settings
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
options
=
{
xnumber2
:
1
,
xstring2
:
"x"
,
xxx
:
"newstring"
},
options
=
{
xnumber2
:
1
,
xstring2
:
"x"
,
xxx
:
"newstring"
},
...
@@ -873,6 +873,9 @@ test("$.extend(Object, Object)", function() {
...
@@ -873,6 +873,9 @@ test("$.extend(Object, Object)", function() {
var
ret
=
jQuery
.
extend
(
true
,
{
foo
:
"1,2,3"
},
{
foo
:
[
1
,
2
,
3
]
}
);
var
ret
=
jQuery
.
extend
(
true
,
{
foo
:
"1,2,3"
},
{
foo
:
[
1
,
2
,
3
]
}
);
ok
(
typeof
ret
.
foo
!=
"string"
,
"Check to make sure values equal with coersion (but not actually equal) overwrite correctly"
);
ok
(
typeof
ret
.
foo
!=
"string"
,
"Check to make sure values equal with coersion (but not actually equal) overwrite correctly"
);
var
ret
=
jQuery
.
extend
(
true
,
{
foo
:
"bar"
},
{
foo
:
null
}
);
equals
(
ret
.
foo
,
null
,
"Check to make sure values equal with coersion (but not actually equal) overwrite correctly"
);
var
defaults
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
var
defaults
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
defaultsCopy
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
defaultsCopy
=
{
xnumber1
:
5
,
xnumber2
:
7
,
xstring1
:
"peter"
,
xstring2
:
"pan"
},
options1
=
{
xnumber2
:
1
,
xstring2
:
"x"
},
options1
=
{
xnumber2
:
1
,
xstring2
:
"x"
},
...
...
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