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
92c84040
Commit
92c84040
authored
Nov 06, 2011
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes jQuery.fragments cache and adds tests. Fixes #10682
parent
8380e12a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
manipulation.js
src/manipulation.js
+1
-1
manipulation.js
test/unit/manipulation.js
+48
-0
No files found.
src/manipulation.js
View file @
92c84040
...
@@ -480,7 +480,7 @@ jQuery.buildFragment = function( args, nodes, scripts ) {
...
@@ -480,7 +480,7 @@ jQuery.buildFragment = function( args, nodes, scripts ) {
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if
(
args
.
length
===
1
&&
typeof
first
===
"string"
&&
first
.
length
<
512
&&
doc
===
document
&&
if
(
args
.
length
===
1
&&
typeof
first
===
"string"
&&
first
.
length
<
512
&&
doc
===
document
&&
first
.
charAt
(
0
)
===
"<"
&&
!
rnocache
.
test
(
first
)
&&
first
.
charAt
(
0
)
===
"<"
&&
!
rnocache
.
test
(
first
)
&&
(
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
first
))
&&
(
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
first
))
||
(
!
jQuery
.
support
.
unknownElems
&&
rnoshimcache
.
test
(
first
))
)
{
(
!
jQuery
.
support
.
unknownElems
&&
rnoshimcache
.
test
(
first
))
)
{
cacheable
=
true
;
cacheable
=
true
;
...
...
test/unit/manipulation.js
View file @
92c84040
...
@@ -1531,3 +1531,51 @@ test("jQuery.clone - no exceptions for object elements #9587", function() {
...
@@ -1531,3 +1531,51 @@ test("jQuery.clone - no exceptions for object elements #9587", function() {
ok
(
false
,
e
.
message
);
ok
(
false
,
e
.
message
);
}
}
});
});
test
(
"jQuery.fragments cache expectations"
,
function
()
{
expect
(
10
);
jQuery
.
fragments
=
{};
function
fragmentCacheSize
()
{
var
n
=
0
,
c
;
for
(
c
in
jQuery
.
fragments
)
{
n
++
;
}
return
n
;
}
jQuery
(
"<li></li>"
);
jQuery
(
"<li>?</li>"
);
jQuery
(
"<li>whip</li>"
);
jQuery
(
"<li>it</li>"
);
jQuery
(
"<li>good</li>"
);
jQuery
(
"<div></div>"
);
jQuery
(
"<div><div><span></span></div></div>"
);
jQuery
(
"<tr><td></td></tr>"
);
jQuery
(
"<tr><td></tr>"
);
jQuery
(
"<li>aaa</li>"
);
jQuery
(
"<ul><li>?</li></ul>"
);
jQuery
(
"<div><p>arf</p>nnn</div>"
);
jQuery
(
"<div><p>dog</p>?</div>"
);
jQuery
(
"<span><span>"
);
equal
(
fragmentCacheSize
(),
12
,
"12 entries exist in jQuery.fragments, 1"
);
jQuery
.
each
(
[
"<tr><td></td></tr>"
,
"<ul><li>?</li></ul>"
,
"<div><p>dog</p>?</div>"
,
"<span><span>"
],
function
(
i
,
frag
)
{
jQuery
(
frag
);
equal
(
jQuery
.
fragments
[
frag
].
nodeType
,
11
,
"Second call with "
+
frag
+
" creates a cached DocumentFragment, has nodeType 11"
);
ok
(
jQuery
.
fragments
[
frag
].
childNodes
.
length
,
"Second call with "
+
frag
+
" creates a cached DocumentFragment, has childNodes with length"
);
});
equal
(
fragmentCacheSize
(),
12
,
"12 entries exist in jQuery.fragments, 2"
);
});
\ No newline at end of file
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