Diff
Modified: trunk/LayoutTests/ChangeLog (175687 => 175688)
--- trunk/LayoutTests/ChangeLog 2014-11-06 07:43:41 UTC (rev 175687)
+++ trunk/LayoutTests/ChangeLog 2014-11-06 07:53:01 UTC (rev 175688)
@@ -1,3 +1,15 @@
+2014-11-05 Shivakumar JM <shiva...@samsung.com>
+
+ splitText API does not match DOM specification.
+ https://bugs.webkit.org/show_bug.cgi?id=138405
+
+ Reviewed by Chris Dumez.
+
+ * fast/dom/Text/splitText-expected.txt: Added.
+ * fast/dom/Text/splitText.html: Added.
+ * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+ * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+
2014-11-05 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r175672.
Added: trunk/LayoutTests/fast/dom/Text/splitText-expected.txt (0 => 175688)
--- trunk/LayoutTests/fast/dom/Text/splitText-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Text/splitText-expected.txt 2014-11-06 07:53:01 UTC (rev 175688)
@@ -0,0 +1,18 @@
+Tests the splitText API arguments.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text.data is "abcdefg"
+PASS text.splitText(4).data is "efg"
+PASS text.data is "abcd"
+PASS text.splitText() threw exception TypeError: Not enough arguments.
+PASS text.splitText(999) threw exception Error: IndexSizeError: DOM Exception 1.
+PASS text.splitText(-1) threw exception Error: IndexSizeError: DOM Exception 1.
+PASS text.data is "abcd"
+PASS text.splitText(-4294967294).data is "cd"
+PASS text.data is "ab"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Text/splitText.html (0 => 175688)
--- trunk/LayoutTests/fast/dom/Text/splitText.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Text/splitText.html 2014-11-06 07:53:01 UTC (rev 175688)
@@ -0,0 +1,24 @@
+<html>
+<head>
+<body>
+<script src=""
+<head>
+<script>
+description("Tests the splitText API arguments.");
+
+var text = document.createTextNode("abcdefg");
+
+shouldBeEqualToString("text.data", "abcdefg");
+shouldBeEqualToString("text.splitText(4).data", "efg");
+shouldBeEqualToString("text.data", "abcd");
+shouldThrow("text.splitText()", "'TypeError: Not enough arguments'");
+shouldThrow("text.splitText(999)", '"Error: IndexSizeError: DOM Exception 1"');
+shouldThrow("text.splitText(-1)", '"Error: IndexSizeError: DOM Exception 1"');
+shouldBeEqualToString("text.data", "abcd");
+shouldBeEqualToString("text.splitText(-4294967294).data", "cd");
+shouldBeEqualToString("text.data", "ab");
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (175687 => 175688)
--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2014-11-06 07:43:41 UTC (rev 175687)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt 2014-11-06 07:53:01 UTC (rev 175688)
@@ -62,7 +62,7 @@
PASS nonNumericPolicy('getSelection().extend(document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().getRangeAt(x)') is 'any type allowed'
PASS nonNumericPolicy('document.styleSheets.item(x)') is 'any type allowed'
-PASS nonNumericPolicy('document.createTextNode("a").splitText(x)') is 'any type allowed'
+PASS nonNumericPolicy('document.createTextNode("a").splitText(x)') is 'any type allowed (but not omitted)'
PASS nonNumericPolicy('document.createTreeWalker(document, x, null, false)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("UIEvent").initUIEvent("a", false, false, null, x)') is 'any type allowed'
PASS nonNumericPolicy('window.scrollBy(x, 0)') is 'any type allowed'
Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (175687 => 175688)
--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js 2014-11-06 07:43:41 UTC (rev 175687)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js 2014-11-06 07:53:01 UTC (rev 175688)
@@ -327,7 +327,7 @@
// Text
-shouldBe("nonNumericPolicy('document.createTextNode(\"a\").splitText(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('document.createTextNode(\"a\").splitText(x)')", "'any type allowed (but not omitted)'");
// TimeRanges
Modified: trunk/Source/WebCore/ChangeLog (175687 => 175688)
--- trunk/Source/WebCore/ChangeLog 2014-11-06 07:43:41 UTC (rev 175687)
+++ trunk/Source/WebCore/ChangeLog 2014-11-06 07:53:01 UTC (rev 175688)
@@ -1,3 +1,18 @@
+2014-11-05 Shivakumar JM <shiva...@samsung.com>
+
+ splitText API does not match DOM specification.
+ https://bugs.webkit.org/show_bug.cgi?id=138405
+
+ Reviewed by Chris Dumez.
+
+ Make the offset argument for splitText API as mandatory (and thus throw if it is omitted) and stop throwing if the offset argument is
+ negative (and wraps to a valid index) as per specification: https://w3c.github.io/dom/#interface-text. Also This matches the behavior
+ of both Firefox 33 and Chrome 38.
+
+ Test: fast/dom/Text/splitText.html
+
+ * dom/Text.idl:
+
2014-11-05 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r175672.
Modified: trunk/Source/WebCore/dom/Text.idl (175687 => 175688)
--- trunk/Source/WebCore/dom/Text.idl 2014-11-06 07:43:41 UTC (rev 175687)
+++ trunk/Source/WebCore/dom/Text.idl 2014-11-06 07:53:01 UTC (rev 175688)
@@ -23,7 +23,7 @@
// DOM Level 1
- [RaisesException] Text splitText([IsIndex,Default=Undefined] optional unsigned long offset);
+ [RaisesException] Text splitText(unsigned long offset);
// Introduced in DOM Level 3:
readonly attribute DOMString wholeText;