-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test initial LF in pre/textarea/listing with innerHTML (#2734)
* Test initial LF in pre/textarea/listing with innerHTML The HTML spec requires this for proper round-tripping, but only Presto has implemented it so far. Ref. whatwg/html#944 * fixup! Test initial LF in pre/textarea/listing with innerHTML Address @jdm's comment.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
html/syntax/serializing-html-fragments/initial-linefeed-pre.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!doctype html> | ||
<title>innerHTML getter for pre/textarea/listing with initial LF</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<div id="outer"> | ||
<div id="inner"> | ||
<pre id="pre1"> | ||
x</pre> | ||
<pre id="pre2"> | ||
|
||
x</pre> | ||
<textarea id="textarea1"> | ||
x</textarea> | ||
<textarea id="textarea2"> | ||
|
||
x</textarea> | ||
<listing id="listing1"> | ||
x</listing> | ||
<listing id="listing2"> | ||
|
||
x</listing> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
var expected_outer = '\n<div id="inner">\n<pre id="pre1">x</pre>\n<pre id="pre2">\n\nx</pre>\n<textarea id="textarea1">x</textarea>\n<textarea id="textarea2">\n\nx</textarea>\n<listing id="listing1">x</listing>\n<listing id="listing2">\n\nx</listing>\n</div>\n'; | ||
var expected_inner = expected_outer.replace('\n<div id="inner">', '').replace('</div>\n', ''); | ||
var expected_1 = 'x'; | ||
var expected_2 = '\nx'; | ||
|
||
test(function() { | ||
assert_equals(outer.innerHTML, expected_outer); | ||
}, 'outer div'); | ||
|
||
test(function() { | ||
assert_equals(inner.innerHTML, expected_inner); | ||
}, 'inner div'); | ||
|
||
['pre', 'textarea', 'listing'].forEach(function(tag) { | ||
test(function() { | ||
assert_equals(document.getElementById(tag + '1').innerHTML, expected_1); | ||
}, tag + '1'); | ||
|
||
test(function() { | ||
assert_equals(document.getElementById(tag + '2').innerHTML, expected_2); | ||
}, tag + '2'); | ||
}); | ||
</script> |