1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<!DOCTYPE html>
<html lang="en" >
<head>
<title>Tokenizer states</title>
<link rel='author' title='Henri Sivonen' href='mailto:hsivonen@hsivonen.fi'>
<link rel='help' href='https://html.spec.whatwg.org/#html-fragment-parsing-algorithm'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(function() {
var e = document.createElement("title");
e.innerHTML = "</title><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</title><div>");
}, "</title> should not break out of title.");
test(function() {
var e = document.createElement("textarea");
e.innerHTML = "</textarea><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</textarea><div>");
}, "</textarea> should not break out of textarea.");
test(function() {
var e = document.createElement("style");
e.innerHTML = "</style><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</style><div>");
}, "</style> should not break out of style.");
test(function() {
var e = document.createElement("xmp");
e.innerHTML = "</xmp><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</xmp><div>");
}, "</xmp> should not break out of xmp.");
test(function() {
var e = document.createElement("iframe");
e.innerHTML = "</iframe><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</iframe><div>");
}, "</iframe> should not break out of iframe.");
test(function() {
var e = document.createElement("noembed");
e.innerHTML = "</noembed><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</noembed><div>");
}, "</noembed> should not break out of noembed.");
test(function() {
var e = document.createElement("noframes");
e.innerHTML = "</noframes><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</noframes><div>");
}, "</noframes> should not break out of noframes.");
test(function() {
var e = document.createElement("script");
e.innerHTML = "<\/script><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "<\/script><div>");
}, "<\/script> should not break out of script.");
test(function() {
var e = document.createElement("noscript");
e.innerHTML = "</noscript><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</noscript><div>");
}, "</noscript> should not break out of noscript.");
test(function() {
var e = document.createElement("plaintext");
e.innerHTML = "</plaintext><div>";
assert_equals(e.getElementsByTagName("div").length, 0);
assert_equals(e.innerHTML, "</plaintext><div>");
}, "</plaintext> should not break out of plaintext.");
</script>
</body>
</html>
|