- Revision
- 99612
- Author
- [email protected]
- Date
- 2011-11-08 13:02:00 -0800 (Tue, 08 Nov 2011)
Log Message
Document.importNode's 'deep' argument should default to true.
https://bugs.webkit.org/show_bug.cgi?id=71190
Patch by Vineet Chaudhary <[email protected]> on 2011-11-08
Reviewed by Adam Barth.
Source/WebCore:
As new specification says deep argument of importNode should be default to true.
Test: fast/dom/document-importNode-arguments.html
* dom/Document.h: Added supportive method.
(WebCore::Document::importNode):
* dom/Document.idl: Modified deep argument as optional.
LayoutTests:
Added test to check document.importNode with No deep argument,
deep argument true and false.
* fast/dom/document-importNode-arguments-expected.txt: Added.
* fast/dom/document-importNode-arguments.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (99611 => 99612)
--- trunk/LayoutTests/ChangeLog 2011-11-08 20:59:47 UTC (rev 99611)
+++ trunk/LayoutTests/ChangeLog 2011-11-08 21:02:00 UTC (rev 99612)
@@ -1,3 +1,16 @@
+2011-11-08 Vineet Chaudhary <[email protected]>
+
+ Document.importNode's 'deep' argument should default to true.
+ https://bugs.webkit.org/show_bug.cgi?id=71190
+
+ Reviewed by Adam Barth.
+
+ Added test to check document.importNode with No deep argument,
+ deep argument true and false.
+
+ * fast/dom/document-importNode-arguments-expected.txt: Added.
+ * fast/dom/document-importNode-arguments.html: Added.
+
2011-11-08 Adam Klein <[email protected]>
WebKitMutationObserver.observe should raise a DOMException if passed invalid arguments
Added: trunk/LayoutTests/fast/dom/document-importNode-arguments-expected.txt (0 => 99612)
--- trunk/LayoutTests/fast/dom/document-importNode-arguments-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/document-importNode-arguments-expected.txt 2011-11-08 21:02:00 UTC (rev 99612)
@@ -0,0 +1,9 @@
+This page tests calling document.importNode.
+
+PASS imported.childNodes.length is 2
+PASS imported.textContent == 'hello world' is true
+PASS imported.childNodes.length is 2
+PASS imported.textContent == 'hello world' is true
+PASS imported.childNodes.length is 0
+PASS imported.textContent == '' is true
+
Added: trunk/LayoutTests/fast/dom/document-importNode-arguments.html (0 => 99612)
--- trunk/LayoutTests/fast/dom/document-importNode-arguments.html (rev 0)
+++ trunk/LayoutTests/fast/dom/document-importNode-arguments.html 2011-11-08 21:02:00 UTC (rev 99612)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p>This page tests calling document.importNode.</p>
+<div id='console'></div>
+<script>
+var imported;
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var d = document.createElement("div");
+d.innerHTML = "<span>hello </span><span>world</span>";
+
+imported = document.importNode(d);
+shouldBe('imported.childNodes.length','2');
+shouldBeTrue("imported.textContent == 'hello world'");
+
+imported = document.importNode(d, true);
+shouldBe('imported.childNodes.length','2');
+shouldBeTrue("imported.textContent == 'hello world'");
+
+imported = document.importNode(d, false);
+shouldBe('imported.childNodes.length','0');
+shouldBeTrue("imported.textContent == ''");
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (99611 => 99612)
--- trunk/Source/WebCore/ChangeLog 2011-11-08 20:59:47 UTC (rev 99611)
+++ trunk/Source/WebCore/ChangeLog 2011-11-08 21:02:00 UTC (rev 99612)
@@ -1,3 +1,18 @@
+2011-11-08 Vineet Chaudhary <[email protected]>
+
+ Document.importNode's 'deep' argument should default to true.
+ https://bugs.webkit.org/show_bug.cgi?id=71190
+
+ Reviewed by Adam Barth.
+
+ As new specification says deep argument of importNode should be default to true.
+
+ Test: fast/dom/document-importNode-arguments.html
+
+ * dom/Document.h: Added supportive method.
+ (WebCore::Document::importNode):
+ * dom/Document.idl: Modified deep argument as optional.
+
2011-11-08 Adam Klein <[email protected]>
WebKitMutationObserver.observe should raise a DOMException if passed invalid arguments
Modified: trunk/Source/WebCore/dom/Document.h (99611 => 99612)
--- trunk/Source/WebCore/dom/Document.h 2011-11-08 20:59:47 UTC (rev 99611)
+++ trunk/Source/WebCore/dom/Document.h 2011-11-08 21:02:00 UTC (rev 99612)
@@ -343,6 +343,7 @@
PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
PassRefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
+ PassRefPtr<Node> importNode(Node* importedNode, ExceptionCode& ec) { return importNode(importedNode, true, ec); }
PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&);
virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser);
Modified: trunk/Source/WebCore/dom/Document.idl (99611 => 99612)
--- trunk/Source/WebCore/dom/Document.idl 2011-11-08 20:59:47 UTC (rev 99611)
+++ trunk/Source/WebCore/dom/Document.idl 2011-11-08 21:02:00 UTC (rev 99612)
@@ -50,7 +50,7 @@
// Introduced in DOM Level 2:
[OldStyleObjC, ReturnsNew] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode,
- in [Optional=CallWithDefaultValue] boolean deep)
+ in [Optional] boolean deep)
raises (DOMException);
[OldStyleObjC, ReturnsNew] Element createElementNS(in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString qualifiedName)