| 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 14 matching lines...) Expand all Loading... |
| 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("bold", "<span><span style='font-weight: bold'>test</span></spa
n>", "<span>test</span>"); | 32 testSingleToggle("bold", "<span><span style='font-weight: bold'>test</span></spa
n>", "<span>test</span>"); |
| 33 testSingleToggle("bold", "<span style='font-weight: bold'><span>test</span></spa
n>", "test"); | 33 testSingleToggle("bold", "<span style='font-weight: bold'><span>test</span></spa
n>", "test"); |
| 34 testSingleToggle("bold", "<span style='font-weight: bold'><span style='font-weig
ht: bold'>test</span></span>", "test"); | 34 testSingleToggle("bold", "<span style='font-weight: bold'><span style='font-weig
ht: bold'>test</span></span>", "test"); |
| 35 testSingleToggle("bold", "<span foo=\"bar\" style='font-weight: bold'>test</span
>", "<span foo=\"bar\">test</span>"); | 35 testSingleToggle("bold", "<span foo=\"bar\" style='font-weight: bold'>test</span
>", "<span foo=\"bar\" style=\"\">test</span>"); |
| 36 testDoubleToggle("bold", "<span>test</span>", "<span>test</span>"); | 36 testDoubleToggle("bold", "<span>test</span>", "<span>test</span>"); |
| 37 | 37 |
| 38 document.body.removeChild(testContainer); | 38 document.body.removeChild(testContainer); |
| 39 | 39 |
| 40 var successfullyParsed = true; | 40 var successfullyParsed = true; |
| OLD | NEW |