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
f42e1e65
Commit
f42e1e65
authored
Dec 11, 2012
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IE failures from
55313d32
parent
ef6d8779
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
core.js
test/unit/core.js
+16
-17
No files found.
test/unit/core.js
View file @
f42e1e65
...
@@ -1206,32 +1206,31 @@ test("jQuery.proxy", function(){
...
@@ -1206,32 +1206,31 @@ test("jQuery.proxy", function(){
});
});
test
(
"jQuery.parseHTML"
,
function
()
{
test
(
"jQuery.parseHTML"
,
function
()
{
expect
(
11
);
expect
(
12
);
var
html
,
nodes
;
equal
(
jQuery
.
parseHTML
(),
null
,
"Nothing in, null out."
);
equal
(
jQuery
.
parseHTML
(),
null
,
"Nothing in, null out."
);
equal
(
jQuery
.
parseHTML
(
null
),
null
,
"N
othing
in, null out."
);
equal
(
jQuery
.
parseHTML
(
null
),
null
,
"N
ull
in, null out."
);
equal
(
jQuery
.
parseHTML
(
""
),
null
,
"
Noth
ing in, null out."
);
equal
(
jQuery
.
parseHTML
(
""
),
null
,
"
Empty str
ing in, null out."
);
raises
(
function
()
{
raises
(
function
()
{
jQuery
.
parseHTML
(
"<div>"
,
document
.
getElementById
(
"form"
)
);
jQuery
.
parseHTML
(
"<div>
</div>
"
,
document
.
getElementById
(
"form"
)
);
},
"Passing an element as the context raises an exception (context should be a document)"
);
},
"Passing an element as the context raises an exception (context should be a document)"
);
var
elems
=
jQuery
.
parseHTML
(
jQuery
(
"body"
).
html
()
);
nodes
=
jQuery
.
parseHTML
(
jQuery
(
"body"
)[
0
].
innerHTML
);
ok
(
elems
.
length
>
10
,
"Parse a large html string"
);
ok
(
nodes
.
length
>
4
,
"Parse a large html string"
);
equal
(
jQuery
.
type
(
elem
s
),
"array"
,
"parseHTML returns an array rather than a nodelist"
);
equal
(
jQuery
.
type
(
node
s
),
"array"
,
"parseHTML returns an array rather than a nodelist"
);
var
script
=
"<script>undefined()</script>"
;
html
=
"<script>undefined()</script>"
;
equal
(
jQuery
.
parseHTML
(
script
).
length
,
0
,
"Passing a script is not allowed by default"
);
equal
(
jQuery
.
parseHTML
(
html
).
length
,
0
,
"Ignore scripts by default"
);
raises
(
function
()
{
equal
(
jQuery
.
parseHTML
(
html
,
true
)[
0
].
nodeName
.
toLowerCase
(),
"script"
,
"Preserve scripts when requested"
);
jQuery
(
jQuery
.
parseHTML
(
script
,
true
)).
appendTo
(
"#qunit-fixture"
);
},
"Passing a script is allowed if allowScripts is true"
);
var
html
=
script
+
"<div></div>"
;
html
+=
"<div></div>"
;
equal
(
jQuery
.
parseHTML
(
html
)[
0
].
nodeName
.
toLowerCase
(),
"div"
,
"Ignore scripts by default"
);
equal
(
jQuery
.
parseHTML
(
html
)[
0
].
nodeName
.
toLowerCase
(),
"div"
,
"Preserve non-script nodes"
);
raises
(
function
()
{
equal
(
jQuery
.
parseHTML
(
html
,
true
)[
0
].
nodeName
.
toLowerCase
(),
"script"
,
"Preserve script position"
);
jQuery
(
jQuery
.
parseHTML
(
html
,
true
)).
appendTo
(
"#qunit-fixture"
);
},
"Passing a script is allowed if allowScripts is true"
);
equal
(
jQuery
.
parseHTML
(
"text"
)[
0
].
nodeType
,
3
,
"Parsing text returns a text node"
);
equal
(
jQuery
.
parseHTML
(
"text"
)[
0
].
nodeType
,
3
,
"Parsing text returns a text node"
);
equal
(
jQuery
.
parseHTML
(
"
\
t<div></div>"
)[
0
].
nodeValue
,
"
\
t"
,
"Preserve leading whitespace"
);
});
});
test
(
"jQuery.parseJSON"
,
function
(){
test
(
"jQuery.parseJSON"
,
function
(){
...
...
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