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
f0732c1e
Commit
f0732c1e
authored
Feb 10, 2012
by
Rick Waldron waldron.rick@gmail.com
Committed by
Dave Methvin
Mar 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11323. Consistently use rscriptType in jQuery.clean()
parent
1ff284d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
manipulation.js
src/manipulation.js
+8
-8
manipulation.js
test/unit/manipulation.js
+3
-3
No files found.
src/manipulation.js
View file @
f0732c1e
...
@@ -644,7 +644,8 @@ jQuery.extend({
...
@@ -644,7 +644,8 @@ jQuery.extend({
},
},
clean
:
function
(
elems
,
context
,
fragment
,
scripts
)
{
clean
:
function
(
elems
,
context
,
fragment
,
scripts
)
{
var
checkScriptType
;
var
checkScriptType
,
script
,
j
,
ret
=
[];
context
=
context
||
document
;
context
=
context
||
document
;
...
@@ -653,8 +654,6 @@ jQuery.extend({
...
@@ -653,8 +654,6 @@ jQuery.extend({
context
=
context
.
ownerDocument
||
context
[
0
]
&&
context
[
0
].
ownerDocument
||
document
;
context
=
context
.
ownerDocument
||
context
[
0
]
&&
context
[
0
].
ownerDocument
||
document
;
}
}
var
ret
=
[],
j
;
for
(
var
i
=
0
,
elem
;
(
elem
=
elems
[
i
])
!=
null
;
i
++
)
{
for
(
var
i
=
0
,
elem
;
(
elem
=
elems
[
i
])
!=
null
;
i
++
)
{
if
(
typeof
elem
===
"number"
)
{
if
(
typeof
elem
===
"number"
)
{
elem
+=
""
;
elem
+=
""
;
...
@@ -762,16 +761,17 @@ jQuery.extend({
...
@@ -762,16 +761,17 @@ jQuery.extend({
return
!
elem
.
type
||
rscriptType
.
test
(
elem
.
type
);
return
!
elem
.
type
||
rscriptType
.
test
(
elem
.
type
);
};
};
for
(
i
=
0
;
ret
[
i
];
i
++
)
{
for
(
i
=
0
;
ret
[
i
];
i
++
)
{
if
(
scripts
&&
jQuery
.
nodeName
(
ret
[
i
],
"script"
)
&&
(
!
ret
[
i
].
type
||
ret
[
i
].
type
.
toLowerCase
()
===
"text/javascript"
)
)
{
script
=
ret
[
i
];
scripts
.
push
(
ret
[
i
].
parentNode
?
ret
[
i
].
parentNode
.
removeChild
(
ret
[
i
]
)
:
ret
[
i
]
);
if
(
scripts
&&
jQuery
.
nodeName
(
script
,
"script"
)
&&
(
!
script
.
type
||
rscriptType
.
test
(
script
.
type
))
)
{
scripts
.
push
(
script
.
parentNode
?
script
.
parentNode
.
removeChild
(
script
)
:
script
);
}
else
{
}
else
{
if
(
ret
[
i
]
.
nodeType
===
1
)
{
if
(
script
.
nodeType
===
1
)
{
var
jsTags
=
jQuery
.
grep
(
ret
[
i
]
.
getElementsByTagName
(
"script"
),
checkScriptType
);
var
jsTags
=
jQuery
.
grep
(
script
.
getElementsByTagName
(
"script"
),
checkScriptType
);
ret
.
splice
.
apply
(
ret
,
[
i
+
1
,
0
].
concat
(
jsTags
)
);
ret
.
splice
.
apply
(
ret
,
[
i
+
1
,
0
].
concat
(
jsTags
)
);
}
}
fragment
.
appendChild
(
ret
[
i
]
);
fragment
.
appendChild
(
script
);
}
}
}
}
}
}
...
...
test/unit/manipulation.js
View file @
f0732c1e
...
@@ -1243,7 +1243,7 @@ test("html(undefined)", function() {
...
@@ -1243,7 +1243,7 @@ test("html(undefined)", function() {
});
});
var
testHtml
=
function
(
valueObj
)
{
var
testHtml
=
function
(
valueObj
)
{
expect
(
3
4
);
expect
(
3
5
);
jQuery
.
scriptorder
=
0
;
jQuery
.
scriptorder
=
0
;
...
@@ -1298,7 +1298,7 @@ var testHtml = function(valueObj) {
...
@@ -1298,7 +1298,7 @@ var testHtml = function(valueObj) {
QUnit
.
reset
();
QUnit
.
reset
();
jQuery
(
"#qunit-fixture"
).
html
(
valueObj
(
"<script type='something/else'>ok( false, 'Non-script evaluated.' );</script><script type='text/javascript'>ok( true, 'text/javascript is evaluated.' );</script><script>ok( true, 'No type is evaluated.' );</script><div><script type='text/javascript'>ok( true, 'Inner text/javascript is evaluated.' );</script><script>ok( true, 'Inner No type is evaluated.' );</script><script type='something/else'>ok( false, 'Non-script evaluated.' );</script></div>"
));
jQuery
(
"#qunit-fixture"
).
html
(
valueObj
(
"<script type='something/else'>ok( false, 'Non-script evaluated.' );</script><script type='text/javascript'>ok( true, 'text/javascript is evaluated.' );</script><script>ok( true, 'No type is evaluated.' );</script><div><script type='text/javascript'>ok( true, 'Inner text/javascript is evaluated.' );</script><script>ok( true, 'Inner No type is evaluated.' );</script><script type='something/else'>ok( false, 'Non-script evaluated.' );</script><
script type='type/ecmascript'>ok( true, 'type/ecmascript evaluated.' );</script><
/div>"
));
var
child
=
jQuery
(
"#qunit-fixture"
).
find
(
"script"
);
var
child
=
jQuery
(
"#qunit-fixture"
).
find
(
"script"
);
...
@@ -1324,7 +1324,7 @@ test("html(String)", function() {
...
@@ -1324,7 +1324,7 @@ test("html(String)", function() {
test
(
"html(Function)"
,
function
()
{
test
(
"html(Function)"
,
function
()
{
testHtml
(
functionReturningObj
);
testHtml
(
functionReturningObj
);
expect
(
3
6
);
expect
(
3
7
);
QUnit
.
reset
();
QUnit
.
reset
();
...
...
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