Title: [197466] trunk/LayoutTests
- Revision
- 197466
- Author
- [email protected]
- Date
- 2016-03-02 14:37:57 -0800 (Wed, 02 Mar 2016)
Log Message
Add a custom element test for synchronous element construction in HTML parser
https://bugs.webkit.org/show_bug.cgi?id=154932
Reviewed by Antti Koivisto.
Added a test.
* fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt: Added.
* fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (197465 => 197466)
--- trunk/LayoutTests/ChangeLog 2016-03-02 22:30:49 UTC (rev 197465)
+++ trunk/LayoutTests/ChangeLog 2016-03-02 22:37:57 UTC (rev 197466)
@@ -1,3 +1,15 @@
+2016-03-02 Ryosuke Niwa <[email protected]>
+
+ Add a custom element test for synchronous element construction in HTML parser
+ https://bugs.webkit.org/show_bug.cgi?id=154932
+
+ Reviewed by Antti Koivisto.
+
+ Added a test.
+
+ * fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt: Added.
+ * fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html: Added.
+
2016-03-02 Filip Pizlo <[email protected]>
Add a benchmark for string transcoding.
Added: trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt (0 => 197466)
--- trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt 2016-03-02 22:37:57 UTC (rev 197466)
@@ -0,0 +1,3 @@
+
+PASS HTML parser must only append nodes that appear before a custom element before instantiating the custom element
+
Added: trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html (0 => 197466)
--- trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html 2016-03-02 22:37:57 UTC (rev 197466)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="HTML parser must construct a custom element synchronously">
+<script src=""
+<script src=""
+<link rel='stylesheet' href=''>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+var childElementCountInConstructor;
+var containerChildNodesInConstructor = [];
+var containerNextSilbingInConstructor;
+class MyCustomElement extends HTMLElement {
+ constructor() {
+ super();
+ var container = document.getElementById('custom-element-container');
+ for (var i = 0; i < container.childNodes.length; i++)
+ containerChildNodesInConstructor.push(container.childNodes[i]);
+ containerNextSilbingInConstructor = container.nextSibling;
+ }
+};
+document.defineCustomElement('my-custom-element', MyCustomElement);
+
+</script>
+<div id="custom-element-container">
+ <span id="custom-element-previous-element"></span>
+ <my-custom-element></my-custom-element>
+ <div id="custom-element-next-element"></div>
+</div>
+<script>
+
+test(function () {
+ var instance = document.querySelector('my-custom-element');
+
+ assert_equals(containerChildNodesInConstructor.length, 3);
+ assert_equals(containerChildNodesInConstructor[0], instance.parentNode.firstChild);
+ assert_equals(containerChildNodesInConstructor[1], document.getElementById('custom-element-previous-element'));
+ assert_equals(containerChildNodesInConstructor[2], instance.previousSibling);
+ assert_equals(containerNextSilbingInConstructor, null);
+
+}, 'HTML parser must only append nodes that appear before a custom element before instantiating the custom element');
+
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes