7 document
.getElementById("console").appendChild(document
.createTextNode(message
+ "\n"));
10 function testParsing(markup
, expected
)
12 var playground
= document
.getElementById("playground");
13 playground
.innerHTML
= markup
;
14 var actual
= playground
.innerHTML
;
15 if (actual
== expected
)
16 log("PASS: " + markup
+ " parsed as " + actual
+ " as expected.");
18 log("FAIL: " + markup
+ " parsed as " + actual
+ " instead of " + expected
);
19 playground
.innerHTML
= "";
24 if (window
.testRunner
)
25 testRunner
.dumpAsText();
27 // One block to cross:
28 testParsing("1<i>2<div>3</i>4</div>5",
29 "1<i>2</i><div><i>3</i>4</div>5");
31 // One block to cross:
32 testParsing("1<i><div>2</i>3</div>4",
33 "1<i></i><div><i>2</i>3</div>4");
35 // Non-affected block to cross:
36 testParsing("1<i>2<object>3</i>4</object>5",
37 "1<i>2<object>34</object>5</i>");
39 // Two blocks to cross:
40 testParsing("1<i>2<div>3<pre>4</i>5</pre>6</div>7",
41 "1<i>2</i><div><i>3</i><pre><i>4</i>5</pre>6</div>7");
43 // Now with an inline without residual style:
44 testParsing("1<i>2<div>3<span>4<pre>5</i>6</pre>7</div>8",
45 "1<i>2</i><div><i>3<span>4</span></i><pre><i>5</i>6</pre>7</div>8");
47 // Now with residual style to restore:
48 testParsing("1<i>2<div>3<pre>4<b>5</i>6</b>7</pre>8</div>9",
49 "1<i>2</i><div><i>3</i><pre><i>4<b>5</b></i><b>6</b>7</pre>8</div>9");
51 // Three blocks to cross:
52 testParsing("1<i>2<div>3<pre>4<p>5</i>6</p>7</pre>8</div>9",
53 "1<i>2</i><div><i>3</i><pre><i>4</i><p><i>5</i>6</p>7</pre>8</div>9");
55 // Non-affected block in the middle:
56 testParsing("1<i>2<div>3<object>4<p>5</i>6</p>7</object>8</div>9",
57 "1<i>2<div>3<object>4<p>56</p>7</object>8</div>9</i>");
59 // Bug 13603 reduction:
60 testParsing("<a href=\"#1\"><div><div><a href=\"#2\"></a><p>Shouldn't be a link</p></div><p>Shouldn't be a link</p></div><p>Shouldn't be a link</p></a>",
61 "<a href=\"#1\"></a><div><a href=\"#1\"></a><div><a href=\"#1\"></a><a href=\"#2\"></a><p>Shouldn't be a link</p></div><p>Shouldn't be a link</p></div><p>Shouldn't be a link</p>");
63 // Almost bug 8750 reduction:
64 testParsing("<p><a>RED</p>RED<div>RED<p>RED<a>RED</a>BLACK</p>BLACK</div>BLACK",
65 "<p><a>RED</a></p><a>RED</a><div><a>RED</a><p><a>RED</a><a>RED</a>BLACK</p>BLACK</div>BLACK");
67 // Bug 12808 reduction:
68 testParsing("<a href=\"#outside\"><p>Outside link.</p><div><div><a href=\"#inside\">Inside link.</a></div></div><p>After all links</p>",
69 "<a href=\"#outside\"><p>Outside link.</p></a><div><a href=\"#outside\"></a><div><a href=\"#outside\"></a><a href=\"#inside\">Inside link.</a></div></div><p>After all links</p>");
71 // Bug 12861 reduction:
72 testParsing("<a href=\"http://webkit.org\"><div><h3><a href=\"about:blank\">This is a link.</a></h3>This is not a link under Firefox, but it is under Safari.",
73 "<a href=\"http://webkit.org\"></a><div><a href=\"http://webkit.org\"></a><h3><a href=\"http://webkit.org\"></a><a href=\"about:blank\">This is a link.</a></h3>This is not a link under Firefox, but it is under Safari.</div>");
78 <body onload=
"test()">
79 <pre id=
"console"></pre>
80 <div id=
"playground"></div>