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
4f2e209b
Commit
4f2e209b
authored
Jan 29, 2010
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure fragment caching is only happening on nodes in the main document. Fixes #5978.
parent
388a00fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
manipulation.js
src/manipulation.js
+8
-4
No files found.
src/manipulation.js
View file @
4f2e209b
...
@@ -384,10 +384,15 @@ function cloneCopyEvent(orig, ret) {
...
@@ -384,10 +384,15 @@ function cloneCopyEvent(orig, ret) {
}
}
function
buildFragment
(
args
,
nodes
,
scripts
)
{
function
buildFragment
(
args
,
nodes
,
scripts
)
{
var
fragment
,
cacheable
,
cacheresults
,
doc
;
var
fragment
,
cacheable
,
cacheresults
,
doc
=
(
nodes
&&
nodes
[
0
]
?
nodes
[
0
].
ownerDocument
||
nodes
[
0
]
:
document
);
// Only cache "small" (1/2 KB) strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
if
(
args
.
length
===
1
&&
typeof
args
[
0
]
===
"string"
&&
args
[
0
].
length
<
512
&&
doc
===
document
&&
args
[
0
].
indexOf
(
"<option"
)
<
0
&&
(
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
args
[
0
]
))
)
{
// webkit does not clone 'checked' attribute of radio inputs on cloneNode, so don't cache if string has a checked
if
(
args
.
length
===
1
&&
typeof
args
[
0
]
===
"string"
&&
args
[
0
].
length
<
512
&&
args
[
0
].
indexOf
(
"<option"
)
<
0
&&
(
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
args
[
0
]
))
)
{
cacheable
=
true
;
cacheable
=
true
;
cacheresults
=
jQuery
.
fragments
[
args
[
0
]
];
cacheresults
=
jQuery
.
fragments
[
args
[
0
]
];
if
(
cacheresults
)
{
if
(
cacheresults
)
{
...
@@ -398,7 +403,6 @@ function buildFragment( args, nodes, scripts ) {
...
@@ -398,7 +403,6 @@ function buildFragment( args, nodes, scripts ) {
}
}
if
(
!
fragment
)
{
if
(
!
fragment
)
{
doc
=
(
nodes
&&
nodes
[
0
]
?
nodes
[
0
].
ownerDocument
||
nodes
[
0
]
:
document
);
fragment
=
doc
.
createDocumentFragment
();
fragment
=
doc
.
createDocumentFragment
();
jQuery
.
clean
(
args
,
doc
,
fragment
,
scripts
);
jQuery
.
clean
(
args
,
doc
,
fragment
,
scripts
);
}
}
...
...
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