summaryrefslogtreecommitdiffstats
path: root/layout/reftests/selection/dom-mutations-ref.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/reftests/selection/dom-mutations-ref.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/reftests/selection/dom-mutations-ref.html')
-rw-r--r--layout/reftests/selection/dom-mutations-ref.html190
1 files changed, 190 insertions, 0 deletions
diff --git a/layout/reftests/selection/dom-mutations-ref.html b/layout/reftests/selection/dom-mutations-ref.html
new file mode 100644
index 000000000..30a0050fc
--- /dev/null
+++ b/layout/reftests/selection/dom-mutations-ref.html
@@ -0,0 +1,190 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=619273
+-->
+<head>
+ <title>Test for Bug 619273</title>
+<script type="application/javascript;version=1.7">
+/** Test DOM mutations inside selection **/
+function createDOM(doc) {
+ let s = doc.createElement('span');
+ s.appendChild(doc.createTextNode('|'))
+ let s2 = doc.createElement('span');
+ s2.appendChild(doc.createTextNode('z'))
+ s.appendChild(s2)
+ return s;
+}
+
+var tests_done = 0;
+var tests = [
+ function(win,doc,sel) {
+ doc.body.innerHTML = '.I<br>B<br>C|z'
+ let a = doc.body.firstChild;
+ let r = doc.createRange();
+ r.setStart(a, 1);
+ r.setEnd(a, 2);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = '.I<br>B<br>C|z'
+ let a = doc.body.firstChild;
+ let r = doc.createRange();
+ r.setStart(doc.firstChild, 0);
+ r.setEnd(a, 2);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>.B<br>C|z'
+ let a = doc.body.firstChild;
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(a, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>.B<br>C|z'
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(doc.body, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>.B<br>C|z'
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(doc, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>B<br>.C|z'
+ let a = doc.body.firstChild;
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(a, 0);
+ r.setEnd(c, 2);
+ sel.addRange(r);
+ },
+
+ function(win,doc,sel) {
+ doc.body.innerHTML = '|z|zI<br>B<br>C'
+ let a = doc.body.firstChild;
+ let r = doc.createRange();
+ r.setStart(a, 4);
+ r.setEnd(a, 5);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = '|z|zI<br>B<br>C'
+ let a = doc.body.firstChild;
+ let r = doc.createRange();
+ r.setStart(doc.firstChild, 0);
+ r.setEnd(a, 5);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>|z|zB<br>C'
+ let a = doc.body.firstChild;
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(a, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>|z|zB<br>C'
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(doc.body, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>|z|zB<br>C'
+ let b = doc.body.childNodes[2];
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(doc, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>B<br>|z|zC'
+ let a = doc.body.firstChild;
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(a, 0);
+ r.setEnd(c, 5);
+ sel.addRange(r);
+ },
+
+ function(win,doc,sel) {
+ doc.body.innerHTML = '<br>B<br>CI'
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = '<br>B<br>C'
+ },
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I<br>B<br>C'
+ let a = doc.body.firstChild;
+ let c = doc.body.childNodes[4];
+ let r = doc.createRange();
+ r.setStart(a, 0);
+ r.setEnd(c, 1);
+ sel.addRange(r);
+ },
+
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'I|z'
+ },
+
+ function(win,doc,sel) {
+ doc.body.innerHTML = 'Iz|'
+
+ document.body.appendChild(document.createTextNode('I'));
+ document.body.appendChild(document.createTextNode(' '));
+ document.body.appendChild(createDOM(document));
+ },
+]
+
+function runTestInIframe(run,t) {
+ let f = document.createElement('iframe');
+ f.setAttribute('frameborder','0');
+ f.setAttribute('height','100');
+ f.setAttribute('width','200');
+ f.src = 'data:text/html,<body style="margin:0;padding:0;font-family:monospace">';
+ f.onload = function () {
+ try {
+ run(f.contentWindow, f.contentDocument, f.contentWindow.getSelection());
+ } finally { ++tests_done; }
+ }
+ return f;
+}
+
+var id;
+function checkFinished() {
+ if (window.frames.length == tests_done) {
+ clearInterval(id);
+ document.documentElement.className = "";
+ }
+}
+
+function runTest() {
+ for (let i=0; i < tests.length; ++i) {
+ let t = tests[i];
+ document.body.appendChild(runTestInIframe(t));
+ }
+ id = setInterval(checkFinished,500);
+}
+</script>
+</head>
+<body onload="runTest()"></body>
+</html>