diff -r 000000000000 -r 6474c204b198 dom/imptests/editing/selecttest/common.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/imptests/editing/selecttest/common.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,952 @@ +"use strict"; +// TODO: iframes, contenteditable/designMode + +// Everything is done in functions in this test harness, so we have to declare +// all the variables before use to make sure they can be reused. +var selection; +var testDiv, paras, detachedDiv, detachedPara1, detachedPara2, + foreignDoc, foreignPara1, foreignPara2, xmlDoc, xmlElement, + detachedXmlElement, detachedTextNode, foreignTextNode, + detachedForeignTextNode, xmlTextNode, detachedXmlTextNode, + processingInstruction, detachedProcessingInstruction, comment, + detachedComment, foreignComment, detachedForeignComment, xmlComment, + detachedXmlComment, docfrag, foreignDocfrag, xmlDocfrag, doctype, + foreignDoctype, xmlDoctype; +var testRanges, testPoints, testNodes; + +function setupRangeTests() { + selection = getSelection(); + testDiv = document.querySelector("#test"); + if (testDiv) { + testDiv.parentNode.removeChild(testDiv); + } + testDiv = document.createElement("div"); + testDiv.id = "test"; + document.body.insertBefore(testDiv, document.body.firstChild); + // Test some diacritics, to make sure browsers are using code units here + // and not something like grapheme clusters. + testDiv.innerHTML = "

Äb̈c̈d̈ëf̈g̈ḧ\n" + + "

Qrstuvwx" + + "