auto merge of #1759 : lpy/servo/issue1743, r=Ms2ger

see #1743
This commit is contained in:
bors-servo 2014-02-26 08:01:42 -05:00
commit 7ff35c0abe
2 changed files with 12 additions and 1 deletions

View file

@ -104,7 +104,7 @@ fn serialize_elem(elem: &JS<Element>, open_elements: &mut ~[~str]) -> ~str {
match elem.get().node.first_child { match elem.get().node.first_child {
Some(ref child) if child.is_text() => { Some(ref child) if child.is_text() => {
let text: JS<CharacterData> = CharacterDataCast::to(child); let text: JS<CharacterData> = CharacterDataCast::to(child);
if text.get().data[0] == 0x0A as u8 { if text.get().data.len() > 0 && text.get().data[0] == 0x0A as u8 {
rv.push_str("\x0A"); rv.push_str("\x0A");
} }
}, },

View file

@ -0,0 +1,11 @@
<html>
<head>
<script src="harness.js"></script>
<script>
var a = document.createElement("div");
a.appendChild(document.createElement("pre")).appendChild(new Text(""));
is(a.innerHTML, "<pre></pre>");
finish();
</script>
</head>
</html>