Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/selection/common.js

Issue 2700673005: selection: Do not run invalid sub-tests with unselectable Range. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698