testText("
", "abc", "abc", "Simplest possible test"); testHTML("
", "abc\ndef", "abc
def", "Newlines convert to
in non-white-space:pre elements"); testHTML("
", "abc\ndef", "abc
def", "Newlines convert to
in
 element");
testHTML("
", "abc\ndef", "abc
def", "Newlines convert to
in white-space:pre element"); testHTML("
", "abc\rdef", "abc
def", "CRs convert to
in non-white-space:pre elements"); testHTML("
", "abc\rdef", "abc
def", "CRs convert to
in
 element");
testHTML("
", "abc\r\ndef", "abc
def", "Newline/CR pair converts to
in non-white-space:pre element"); testHTML("
", "abc\n\ndef", "abc

def", "Newline/newline pair converts to two
s in non-white-space:pre element"); testHTML("
", "abc\r\rdef", "abc

def", "CR/CR pair converts to two
s in non-white-space:pre element"); testHTML("
", "abc\rdef", "abc
def", "CRs convert to
in white-space:pre element"); testText("
", "abc", "abc>def", "abc>def", "> preserved"); testText("
", "abc&", "abc&", "& preserved"); testText("
", "abc\"def", "abc\"def", "\" preserved"); testText("
", "abc\'def", "abc\'def", "\' preserved"); testHTML("", "abc", "", "innerText not supported on SVG elements"); testHTML("", "abc", "", "innerText not supported on MathML elements"); testText("
", "abc\0def", "abc\0def", "Null characters preserved"); testText("
", "abc\tdef", "abc\tdef", "Tabs preserved"); testText("
", " abc", " abc", "Leading whitespace preserved"); testText("
", "abc ", "abc ", "Trailing whitespace preserved"); testText("
", "abc def", "abc def", "Whitespace not compressed"); testText("
abc\n\n", "abc", "abc", "Existing text deleted"); testText("

", "abc", "abc", "Existing
deleted"); testHTML("
", "", "", "Assigning the empty string"); testHTML("
", null, "", "Assigning null"); testHTML("
", undefined, "undefined", "Assigning undefined"); // Setting innerText on these should not throw ["area", "base", "basefont", "bgsound", "br", "col", "embed", "frame", "hr", "image", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr", "colgroup", "frameset", "head", "html", "table", "tbody", "tfoot", "thead", "tr"].forEach(function(tag) { testText(document.createElement(tag), "abc", "abc", "innerText on <" + tag + "> element"); });