Skip to content

Commit

Permalink
Add checks for non-callable lifecycle callbacks at registration time
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Mar 11, 2016
1 parent 812e53a commit a5df449
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/custom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ <h3>Enqueuing and Invoking Callbacks</h3>

<li>Let <var>callbacks</var> be <var>definition</var>'s <a href="#dfn-element-definition-lifecycle-callbacks">lifecycle callbacks</a>.</li>

<li>Let <var>callback</var> be callback in <var>callbacks</var> named <var>callbackName</var>. If there is no such callback, abort these steps.</li>
<li>Let <var>callback</var> be callback in <var>callbacks</var> named <var>callbackName</var>.</li>

<li>If <var>callback</var> is undefined, abort these steps.</li>

<li>
<p>If <var>callbackName</var> is "<code>attributeChangedCallback</code>":</p>
Expand Down Expand Up @@ -653,11 +655,17 @@ <h3>DOM+: New <a href="https://dom.spec.whatwg.org/#document"><code>Document</co

<li>Let <var>attachedCallback</var> be <a href="https://tc39.github.io/ecma262/#sec-get-o-p">Get</a>(<var>prototype</var>, "attachedCallback"). Rethrow any exceptions.</li>

<li>If <var>attachedCallback</var> is not undefined, and <a href="https://tc39.github.io/ecma262/#sec-iscallable">IsCallable</a>(<var>attachedCallback</var>) is false, <a href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a <code>TypeError</code> exception.</li>

<li>Let <var>detachedCallback</var> be <a href="https://tc39.github.io/ecma262/#sec-get-o-p">Get</a>(<var>prototype</var>, "detachedCallback"). Rethrow any exceptions.</li>

<li>If <var>detachedCallback</var> is not undefined, and <a href="https://tc39.github.io/ecma262/#sec-iscallable">IsCallable</a>(<var>detachedCallback</var>) is false, <a href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a <code>TypeError</code> exception.</li>

<li>Let <var>attributeChangedCallback</var> be <a href="https://tc39.github.io/ecma262/#sec-get-o-p">Get</a>(<var>prototype</var>, "attributeChangedCallback"). Rethrow any exceptions.</li>

<li>Let <var>definition</var> be a new <a>custom element definition</a> with <a href="#dfn-element-definition-name">name</a> <var>name</var>, <a href="#dfn-element-definition-local-name">local name</a> <var>localName</var>, <a href="#dfn-element-definition-constructor">constructor</a> <var>constructor</var>, <a href="#dfn-element-definition-prototype">prototype</a> <var>prototype</var>, <a href="#dfn-element-definition-observed-attributes">observed attributes</a> <var>observedAttributes</var>, and <a href="#dfn-element-definition-lifecycle-callbacks">lifecycle callbacks</a> <var>attachedCallback</var>, <var>detachedCallback</var>, and <var>attributeChangedCallback</var>.</li>
<li>If <var>attributeChangedCallback</var> is not undefined, and <a href="https://tc39.github.io/ecma262/#sec-iscallable">IsCallable</a>(<var>attributeChangedCallback</var>) is false, <a href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a <code>TypeError</code> exception.</li>

<li>Let <var>definition</var> be a new <a>custom element definition</a> with <a href="#dfn-element-definition-name">name</a> <var>name</var>, <a href="#dfn-element-definition-local-name">local name</a> <var>localName</var>, <a href="#dfn-element-definition-constructor">constructor</a> <var>constructor</var>, <a href="#dfn-element-definition-prototype">prototype</a> <var>prototype</var>, <a href="#dfn-element-definition-observed-attributes">observed attributes</a> <var>observedAttributes</var>, and <a href="#dfn-element-definition-lifecycle-callbacks">lifecycle callbacks</a> <var>attachedCallback</var>, <var>detachedCallback</var>, and <var>attributeChangedCallback</var> (stored with their corresponding name).</li>

<li>Add <var>definition</var> to <var>registry</var>.</li>

Expand Down

0 comments on commit a5df449

Please sign in to comment.