From 318dcf3b044dd4ba679e40c71eb5105cad67a391 Mon Sep 17 00:00:00 2001 From: Hixie Date: Wed, 7 Jan 2015 11:31:52 -0800 Subject: [PATCH] Specs: handle (in the parser) the case of an element constructor being turned into something that doesn't inherit from Element, since JS lets you do that kind of thing after registration Review URL: https://codereview.chromium.org/829113003 --- specs/dom.md | 2 +- specs/parsing.md | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/specs/dom.md b/specs/dom.md index e30b027e099..115c33a248c 100644 --- a/specs/dom.md +++ b/specs/dom.md @@ -77,7 +77,7 @@ abstract class Element : ParentNode { // Returns a new Array and new Attr instances every time. Array getAttributes(); // O(N) in number of attributes - readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow root + readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow root // TODO(ianh): Should this be mutable? It would help explain how it gets set... Array getDestinationInsertionPoints(); // O(N) in number of insertion points the node is in virtual void endTagParsedCallback(); // noop diff --git a/specs/parsing.md b/specs/parsing.md index f1e9f8d1db9..799d225cbf5 100644 --- a/specs/parsing.md +++ b/specs/parsing.md @@ -802,13 +802,18 @@ _document_: 1. If the tag name isn't a registered tag name, then yield until _imported modules_ contains no entries with unresolved promises. - 2. If the tag name is registered, create an element _node_ with - tag name and attributes given by the token. Otherwise, create - an element with the tag name "error" and the attributes given - by the token. - 3. Append _node_ to the top node in the _stack of open nodes_. - 4. Push _node_ onto the top of the _stack of open nodes_. - 5. If _node_ is a ``template`` element, then: + 2. If the tag name is not registered, then let the ErrorElement + constructor from sky:core be the element constructor. + Otherwise, let the element constructor be the registered + element's constructor for that tag name in this module. + 3. Create an element _node_ with the attributes given by the + token by calling the constructor. + 4. If _node_ is not an Element object, then let the constructor + be the ErrorElement constructor and return to the previous + step. + 5. Append _node_ to the top node in the _stack of open nodes_. + 6. Push _node_ onto the top of the _stack of open nodes_. + 7. If _node_ is a ``template`` element, then: 1. Let _fragment_ be the ``DocumentFragment`` object that the ``template`` element uses as its template contents container. 2. Push _fragment_ onto the top of the _stack of open nodes_.