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
29bf601f
Commit
29bf601f
authored
Jan 10, 2009
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an issue with script nodes being removed incorrectly, fixes #3737.
parent
afb05081
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+4
-1
No files found.
src/core.js
View file @
29bf601f
...
@@ -922,7 +922,7 @@ jQuery.extend({
...
@@ -922,7 +922,7 @@ jQuery.extend({
if
(
fragment
)
{
if
(
fragment
)
{
for
(
var
i
=
0
;
ret
[
i
];
i
++
)
{
for
(
var
i
=
0
;
ret
[
i
];
i
++
)
{
if
(
jQuery
.
nodeName
(
ret
[
i
],
"script"
)
)
{
if
(
jQuery
.
nodeName
(
ret
[
i
],
"script"
)
)
{
scripts
.
push
(
ret
[
i
].
parentNode
.
removeChild
(
ret
[
i
]
)
);
scripts
.
push
(
ret
[
i
].
parentNode
?
ret
[
i
].
parentNode
.
removeChild
(
ret
[
i
]
)
:
ret
[
i
]
);
}
else
{
}
else
{
if
(
ret
[
i
].
nodeType
===
1
)
if
(
ret
[
i
].
nodeType
===
1
)
ret
.
splice
.
apply
(
ret
,
[
i
+
1
,
0
].
concat
(
jQuery
.
makeArray
(
ret
[
i
].
getElementsByTagName
(
"script"
)))
);
ret
.
splice
.
apply
(
ret
,
[
i
+
1
,
0
].
concat
(
jQuery
.
makeArray
(
ret
[
i
].
getElementsByTagName
(
"script"
)))
);
...
...
test/unit/core.js
View file @
29bf601f
...
@@ -899,7 +899,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
...
@@ -899,7 +899,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
});
});
test
(
"appendTo(String|Element|Array<Element>|jQuery)"
,
function
()
{
test
(
"appendTo(String|Element|Array<Element>|jQuery)"
,
function
()
{
expect
(
6
);
expect
(
7
);
var
defaultText
=
'Try them out:'
var
defaultText
=
'Try them out:'
jQuery
(
'<b>buga</b>'
).
appendTo
(
'#first'
);
jQuery
(
'<b>buga</b>'
).
appendTo
(
'#first'
);
equals
(
jQuery
(
"#first"
).
text
(),
defaultText
+
'buga'
,
'Check if text appending works'
);
equals
(
jQuery
(
"#first"
).
text
(),
defaultText
+
'buga'
,
'Check if text appending works'
);
...
@@ -915,6 +915,9 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
...
@@ -915,6 +915,9 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
jQuery
([
document
.
getElementById
(
'first'
),
document
.
getElementById
(
'yahoo'
)]).
appendTo
(
'#sap'
);
jQuery
([
document
.
getElementById
(
'first'
),
document
.
getElementById
(
'yahoo'
)]).
appendTo
(
'#sap'
);
equals
(
expected
,
jQuery
(
'#sap'
).
text
(),
"Check for appending of array of elements"
);
equals
(
expected
,
jQuery
(
'#sap'
).
text
(),
"Check for appending of array of elements"
);
reset
();
ok
(
jQuery
(
document
.
createElement
(
"script"
)).
appendTo
(
"body"
).
length
,
"Make sure a disconnected script can be appended."
);
reset
();
reset
();
expected
=
document
.
querySelectorAll
?
expected
=
document
.
querySelectorAll
?
"This link has class=
\"
blog
\"
: Simon Willison's WeblogYahooTry them out:"
:
"This link has class=
\"
blog
\"
: Simon Willison's WeblogYahooTry them out:"
:
...
...
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