Created
October 18, 2010 22:31
-
-
Save dfjones/633213 to your computer and use it in GitHub Desktop.
Tests extractContents when there are multiple ranges over a text node
This file contains hidden or 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
| <html> | |
| <head> | |
| <script type="text/javascript" src="../rangy-core-146-src.js"></script> | |
| <script type="text/javascript"> | |
| window.onload = function() { | |
| rangy.init(); | |
| var r = rangy.createRange(), r1 = rangy.createRange(), | |
| r2 = rangy.createRange(); | |
| var p = document.getElementById("para"); | |
| var t = document.createTextNode("Some text..."); | |
| p.appendChild(t); | |
| r.selectNodeContents(t); | |
| r.setStart(r.startContainer, 5); | |
| r.setEnd(r.endContainer, 7); | |
| r1.setStart(r.startContainer, 0); | |
| r1.setEnd(r.startContainer, r.startOffset); | |
| r2.selectNodeContents(r.endContainer); | |
| r2.setStart(r.endContainer, r.endOffset); | |
| var f = r1.extractContents(); | |
| r1.insertNode(f); | |
| f = r2.extractContents(); | |
| r2.insertNode(f); | |
| } | |
| </script> | |
| <body> | |
| <p id="para"> | |
| </p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment