Index: third_party/WebKit/LayoutTests/fast/dom/StaticRange/staticrange-no-mutate.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/StaticRange/staticrange-no-mutate.html b/third_party/WebKit/LayoutTests/fast/dom/StaticRange/staticrange-no-mutate.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6dec75d2130f0fe1127ce5d83c4b632436a42634 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dom/StaticRange/staticrange-no-mutate.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<title>StaticRange: No mutate on DOM change</title> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+abcdefg |
+<script> |
+test(function() { |
+ // Initialize. |
+ var txt = document.body.firstChild; |
+ var staticRange = new StaticRange(); |
+ staticRange.setStart(txt, 0); |
+ staticRange.setEnd(txt, 5); |
+ var range = staticRange.toRange(); |
+ |
+ // Split text and StaticRange shouldn't mutate. |
+ txt.splitText(2); |
+ assert_equals(staticRange.startContainer, txt); |
+ assert_equals(staticRange.startOffset, 0); |
+ assert_equals(staticRange.endContainer, txt); |
+ assert_equals(staticRange.endOffset, 5); |
+ |
+ // Range should mutate. |
+ assert_equals(range.startContainer, txt); |
+ assert_equals(range.startOffset, 0); |
+ assert_equals(range.endContainer, txt.nextSibling); |
+ assert_equals(range.endOffset, 3); |
+}, 'Testing StaticRange wont mutate on DOM change'); |
+</script> |
+</body> |
+</html> |