| OLD | NEW |
| 1 description("Test to make sure we remove span tags with no attributes if we remo
ved the last attribute.") | 1 description("Test to make sure we remove span tags with no attributes if we remo
ved the last attribute.") |
| 2 | 2 |
| 3 var testContainer = document.createElement("div"); | 3 var testContainer = document.createElement("div"); |
| 4 testContainer.contentEditable = true; | 4 testContainer.contentEditable = true; |
| 5 document.body.appendChild(testContainer); | 5 document.body.appendChild(testContainer); |
| 6 | 6 |
| 7 function testSingleToggle(toggleCommand, initialContents, expectedContents) | 7 function testSingleToggle(toggleCommand, initialContents, expectedContents) |
| 8 { | 8 { |
| 9 testContainer.innerHTML = initialContents; | 9 testContainer.innerHTML = initialContents; |
| 10 window.getSelection().selectAllChildren(testContainer); | 10 window.getSelection().selectAllChildren(testContainer); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 document.execCommand(toggleCommand, false, null); | 23 document.execCommand(toggleCommand, false, null); |
| 24 document.execCommand(toggleCommand, false, null); | 24 document.execCommand(toggleCommand, false, null); |
| 25 if (testContainer.innerHTML === expectedContents) { | 25 if (testContainer.innerHTML === expectedContents) { |
| 26 testPassed("two " + toggleCommand + " commands converted " + initialCont
ents + " to " + expectedContents); | 26 testPassed("two " + toggleCommand + " commands converted " + initialCont
ents + " to " + expectedContents); |
| 27 } else { | 27 } else { |
| 28 testFailed("two " + toggleCommand + " commands converted " + initialCont
ents + " to " + testContainer.innerHTML + ", expected " + expectedContents); | 28 testFailed("two " + toggleCommand + " commands converted " + initialCont
ents + " to " + testContainer.innerHTML + ", expected " + expectedContents); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 testSingleToggle("underline", "test", "<u>test</u>"); | 32 testSingleToggle("underline", "test", "<u>test</u>"); |
| 33 testSingleToggle("underline", "<u><b><strike>test</strike></b></u>", "<b><strike
>test</strike></b>"); | 33 testSingleToggle("underline", "<u><b><strike>test</strike></b></u>", "<b style=\
"\"><strike style=\"\">test</strike></b>"); |
| 34 testDoubleToggle("underline", "test", "test"); | 34 testDoubleToggle("underline", "test", "test"); |
| 35 testSingleToggle("strikethrough", "test", "<strike>test</strike>"); | 35 testSingleToggle("strikethrough", "test", "<strike>test</strike>"); |
| 36 testSingleToggle("strikethrough", "<u><b><strike>test</strike></b></u>", "<u><b>
test</b></u>"); | 36 testSingleToggle("strikethrough", "<u><b><strike>test</strike></b></u>", "<u><b>
test</b></u>"); |
| 37 testDoubleToggle("strikethrough", "test", "test"); | 37 testDoubleToggle("strikethrough", "test", "test"); |
| 38 | 38 |
| 39 testSingleToggle("strikethrough", "<u>test</u>", "<u><strike>test</strike></u>")
; | 39 testSingleToggle("strikethrough", "<u>test</u>", "<u><strike>test</strike></u>")
; |
| 40 testSingleToggle("underline", "<strike>test</strike>", "<u><strike>test</strike>
</u>"); | 40 testSingleToggle("underline", "<strike>test</strike>", "<u><strike>test</strike>
</u>"); |
| 41 | 41 |
| 42 testSingleToggle("strikethrough", '<span style="text-decoration: overline;">test
</span>', '<span style="text-decoration-line: overline;"><strike>test</strike></
span>'); | 42 testSingleToggle("strikethrough", '<span style="text-decoration: overline;">test
</span>', '<span style="text-decoration-line: overline;"><strike>test</strike></
span>'); |
| 43 testSingleToggle("underline", '<span style="text-decoration: overline;">test</sp
an>', '<span style="text-decoration-line: overline;"><u>test</u></span>'); | 43 testSingleToggle("underline", '<span style="text-decoration: overline;">test</sp
an>', '<span style="text-decoration-line: overline;"><u>test</u></span>'); |
| 44 | 44 |
| 45 document.body.removeChild(testContainer); | 45 document.body.removeChild(testContainer); |
| 46 | 46 |
| 47 var successfullyParsed = true; | 47 var successfullyParsed = true; |
| OLD | NEW |