Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/execCommand/script-tests/empty-span-removal.js

Issue 2800723002: Ensure we never remove the style attribute when syncing it from CSSOM. (Closed)
Patch Set: Nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698