OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 // TODO: iframes, contenteditable/designMode | 2 // TODO: iframes, contenteditable/designMode |
3 | 3 |
4 // Everything is done in functions in this test harness, so we have to declare | 4 // Everything is done in functions in this test harness, so we have to declare |
5 // all the variables before use to make sure they can be reused. | 5 // all the variables before use to make sure they can be reused. |
6 var selection; | 6 var selection; |
7 var testDiv, paras, detachedDiv, detachedPara1, detachedPara2, | 7 var testDiv, paras, detachedDiv, detachedPara1, detachedPara2, |
8 foreignDoc, foreignPara1, foreignPara2, xmlDoc, xmlElement, | 8 foreignDoc, foreignPara1, foreignPara2, xmlDoc, xmlElement, |
9 detachedXmlElement, detachedTextNode, foreignTextNode, | 9 detachedXmlElement, detachedTextNode, foreignTextNode, |
10 detachedForeignTextNode, xmlTextNode, detachedXmlTextNode, | 10 detachedForeignTextNode, xmlTextNode, detachedXmlTextNode, |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 func(); | 970 func(); |
971 | 971 |
972 assert_equals(selection.rangeCount, originalCount, | 972 assert_equals(selection.rangeCount, originalCount, |
973 "The operation should not add Range"); | 973 "The operation should not add Range"); |
974 if (originalCount < 1) | 974 if (originalCount < 1) |
975 return; | 975 return; |
976 assert_equals(selection.getRangeAt(0), originalRange, | 976 assert_equals(selection.getRangeAt(0), originalRange, |
977 "The operation should not replace a registered Range"); | 977 "The operation should not replace a registered Range"); |
978 } | 978 } |
979 | 979 |
| 980 /** |
| 981 * Check if the specified node can be selectable with window.getSelection() |
| 982 * methods. |
| 983 */ |
| 984 function isSelectableNode(node) { |
| 985 if (!node) |
| 986 return false; |
| 987 if (node.nodeType == Node.DOCUMENT_TYPE_NODE) |
| 988 return false; |
| 989 return document.contains(node); |
| 990 } |
OLD | NEW |