From 3286f0085ce3ee20e5f0fe03b7f6f09179696555 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 8 Mar 2016 14:07:23 -0500 Subject: [PATCH] Implement observedAttributes processing Fixes #367. As discussed there "observedAttributes" is a better name for an opt-in list than "attributeFilter" (which sounds like opt-out). --- spec/custom/index.html | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/spec/custom/index.html b/spec/custom/index.html index 516e0e15..e0f15330 100644 --- a/spec/custom/index.html +++ b/spec/custom/index.html @@ -149,11 +149,12 @@

Concepts

A custom element definition describes a custom element and consists of:

@@ -302,6 +303,15 @@

Enqueuing and Invoking Callbacks

  • Let callback be callback in callbacks named callbackName. If there is no such callback, abort these steps.
  • +
  • +

    If callbackName is "attributeChangedCallback":

    + +
      +
    1. Let attributeName be the the first element of args.
    2. +
    3. If definition's observed attributes does not contain attributeName, abort these steps.
    4. +
    +
  • +
  • Add a callback action to element's custom element action queue, with callback function callback and arguments args.
  • If element's element is being created flag is false, add element to the current element queue.
  • @@ -523,6 +533,10 @@

    New Document +
  • Let observedAttributesIterable be Get(constructor, "observedAttributes"). Rethrow any exceptions.
  • + +
  • If observedAttributesIterable is undefined, let observedAttributes be an empty sequence<DOMString>. Otherwise, let observedAttributes be the result of converting observedAttributesIterable to a sequence<DOMString>. Rethrow any exceptions. +
  • Let prototype be Get(constructor, "prototype"). Rethrow any exceptions.
  • If Type(prototype) is not Object, throw a TypeError exception.
  • @@ -533,7 +547,7 @@

    New DocumentLet attributeChangedCallback be Get(prototype, "attributeChangedCallback"). Rethrow any exceptions. -
  • Let definition be a new custom element definition with custom element name name, local name localName, constructor constructor, prototype prototype, and lifecycle callbacks attachedCallback, detachedCallback, and attributeChangedCallback.
  • +
  • Let definition be a new custom element definition with custom element name name, local name localName, constructor constructor, prototype prototype, observed attributes observedAttributes, and lifecycle callbacks attachedCallback, detachedCallback, and attributeChangedCallback.
  • Add definition to registry.