Title: [203803] trunk
Revision
203803
Author
[email protected]
Date
2016-07-27 16:28:27 -0700 (Wed, 27 Jul 2016)

Log Message

Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160274

Reviewed by Darin Adler.

Source/WebCore:

Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory:
- https://dom.spec.whatwg.org/#element
- https://www.w3.org/TR/DOM-Parsing/#extensions-to-the-element-interface

Firefox and Chrome agree with the specification (although Firefox does not
have insertAdjacentText()).

Test: fast/dom/Element/insertAdjacentText-parameters.html

* html/HTMLElement.idl:

LayoutTests:

Add test coverage.

* fast/dom/Element/insertAdjacentText-parameters-expected.txt: Added.
* fast/dom/Element/insertAdjacentText-parameters.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203802 => 203803)


--- trunk/LayoutTests/ChangeLog	2016-07-27 23:22:55 UTC (rev 203802)
+++ trunk/LayoutTests/ChangeLog	2016-07-27 23:28:27 UTC (rev 203803)
@@ -1,5 +1,17 @@
 2016-07-27  Chris Dumez  <[email protected]>
 
+        Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160274
+
+        Reviewed by Darin Adler.
+
+        Add test coverage.
+
+        * fast/dom/Element/insertAdjacentText-parameters-expected.txt: Added.
+        * fast/dom/Element/insertAdjacentText-parameters.html: Added.
+
+2016-07-27  Chris Dumez  <[email protected]>
+
         Parameters to DOMParser.parseFromString() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160268
 

Added: trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters-expected.txt (0 => 203803)


--- trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters-expected.txt	2016-07-27 23:28:27 UTC (rev 203803)
@@ -0,0 +1,13 @@
+Test that parameters to insertAdjacentText() / insertAdjacentHTML() are mandatory.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.body.insertAdjacentText() threw exception TypeError: Not enough arguments.
+PASS document.body.insertAdjacentText('beforebegin') threw exception TypeError: Not enough arguments.
+PASS document.body.insertAdjacentHTML() threw exception TypeError: Not enough arguments.
+PASS document.body.insertAdjacentHTML('beforebegin') threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters.html (0 => 203803)


--- trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/insertAdjacentText-parameters.html	2016-07-27 23:28:27 UTC (rev 203803)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that parameters to insertAdjacentText() / insertAdjacentHTML() are mandatory.");
+
+shouldThrow("document.body.insertAdjacentText()", "'TypeError: Not enough arguments'");
+shouldThrow("document.body.insertAdjacentText('beforebegin')", "'TypeError: Not enough arguments'");
+shouldThrow("document.body.insertAdjacentHTML()", "'TypeError: Not enough arguments'");
+shouldThrow("document.body.insertAdjacentHTML('beforebegin')", "'TypeError: Not enough arguments'");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203802 => 203803)


--- trunk/Source/WebCore/ChangeLog	2016-07-27 23:22:55 UTC (rev 203802)
+++ trunk/Source/WebCore/ChangeLog	2016-07-27 23:28:27 UTC (rev 203803)
@@ -1,3 +1,21 @@
+2016-07-27  Chris Dumez  <[email protected]>
+
+        Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160274
+
+        Reviewed by Darin Adler.
+
+        Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory:
+        - https://dom.spec.whatwg.org/#element
+        - https://www.w3.org/TR/DOM-Parsing/#extensions-to-the-element-interface
+
+        Firefox and Chrome agree with the specification (although Firefox does not
+        have insertAdjacentText()).
+
+        Test: fast/dom/Element/insertAdjacentText-parameters.html
+
+        * html/HTMLElement.idl:
+
 2016-07-27  Beth Dakin  <[email protected]>
 
         Add localizable strings for inserting list types

Modified: trunk/Source/WebCore/html/HTMLElement.idl (203802 => 203803)


--- trunk/Source/WebCore/html/HTMLElement.idl	2016-07-27 23:22:55 UTC (rev 203802)
+++ trunk/Source/WebCore/html/HTMLElement.idl	2016-07-27 23:28:27 UTC (rev 203803)
@@ -46,9 +46,8 @@
 
     [RaisesException] Element insertAdjacentElement(DOMString where, Element element);
 
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    [RaisesException] void insertAdjacentHTML(optional DOMString where = "undefined", optional DOMString html = "undefined");
-    [RaisesException] void insertAdjacentText(optional DOMString where = "undefined", optional DOMString text = "undefined");
+    [RaisesException] void insertAdjacentHTML(DOMString where, DOMString html);
+    [RaisesException] void insertAdjacentText(DOMString where, DOMString text);
 
     [SetterRaisesException] attribute DOMString contentEditable;
     readonly attribute boolean isContentEditable;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to