[w3c/webcomponents] Clarify "report an exception" for Custom Elements (#635)

The [latest plan](https://github.com/whatwg/html/issues/958#issuecomment-226309871) in https://github.com/whatwg/html/issues/958 doesn't cover all custom element cases, so I filed this issue to clarify them. Please let me know if I should move this discussion to https://github.com/whatwg/html/issues/958, or other places. 

## custom element constructor ##
There are two places will call custom element constructor:
1. Step 7.1 of [upgrade an element](https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element).
2. Step 6.2. of [create an element](https://dom.spec.whatwg.org/#concept-create-element).

The exception thrown from the constructor will get taken care of automatically by the __guarded__ flag, right?

## upgrade reactions ##
Operations, attributes, setters, or deleters annotated with the [[CEReactions] extended attribute](https://html.spec.whatwg.org/multipage/scripting.html#cereactions) will possibly invoke upgrade reaction after executing the listed actions. e.g.,
- customElements.define()
- node.cloneNode()
- document.importNode()
- document.write()
- document.writeln()
- .....

How to report the exception thrown from [upgrade](https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element) (i.e., Step 7.2) is not defined in [latest plan](https://github.com/whatwg/html/issues/958#issuecomment-226309871).
> Custom element upgrade reactions will need a bit of care; will have to think on it a bit more.

## create an element ##
There are some places that run [create an element](https://dom.spec.whatwg.org/#concept-create-element) with __the synchronous custom elements flag set__, 
1. [document.createElement()](https://dom.spec.whatwg.org/#dom-document-createelement) (Step 5)
2. [document.createElementNS()](https://dom.spec.whatwg.org/#dom-document-createelementns) (Step 4 of [internal createElementNS steps](https://dom.spec.whatwg.org/#internal-createelementns-steps))
3. [create element for token](https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token) with __execute script is true__ (Step 7)

For 3),  the exceptions will be reported to the document's window (since it is during parsing), right? What about the 1) and 2)?


/cc @domenic. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/635

Received on Friday, 7 April 2017 08:11:08 UTC