diff --git a/spec/custom/index.html b/spec/custom/index.html index c0c33fcd..1f6fb85a 100644 --- a/spec/custom/index.html +++ b/spec/custom/index.html @@ -638,11 +638,38 @@

Custom Elements and ECMAScript 6

Once the ECMAScript Standard Edition 6 is released, this section will be integrated into the respective areas of this specification. Until then, here is an overview of how ECMAScript 6 and Custom Elements integrate.

-

If the user agent implements the @@create method, this specification would stop treating the ElementRegistrationOptions options argument in registerElement as a dictionary, and instead view it as a the custom element constructor function.

+

If the user agent implements the @@create method, this specification would stop treating the ElementRegistrationOptions options argument in registerElement as a dictionary, and instead view it as a the custom element constructor.

-

Instead of generating a constructor, the user agent will now mutate this constructor function to have a new @@create method that creates a new element object.

+

Instead of generating a constructor, the user agent will now mutate this argument to have a new @@create method that creates a new element object.

-

Accordingly, the steps run when calling registerElement will change to:

+

Since the registerElement's second argument is now a constructor function, the element definition should change to hold that constructor function, rather than the custom element prototype.

+ +

To accommodate this change, the element registration alorightm to the following steps:

+
+ +
+
+
Input
+
DOCUMENT, the document
+
TYPE, the custom element type of the element being registered
+
FUNCTION, the custom element constructor
+
NAME, a local name, optional
+
Output
+
ERROR, a variable that holds one of these values: None, InvalidType, InvalidName, NoRegistry, or DuplicateDefinition
+
+
    +
  1. Let ERROR and DEFINITION be the result of running definition construction algorithm with DOCUMENT, TYPE, PROTOTYPE, and NAME as arguments
  2. +
  3. If ERROR is not None, stop.
  4. +
  5. Let REGISTRY be DOCUMENT's registry
  6. +
  7. If REGISTRY does not exist, set ERROR to NoRegistry and stop.
  8. +
  9. Add DEFINITION to REGISTRY
  10. +
  11. Let MAP be REGISTRY's upgrade candidates map
  12. +
  13. Run element upgrade algorithm with MAP and DEFINITION as arguments.
  14. +
+
+ +
+

The steps run when calling registerElement will change to:

@@ -650,7 +677,7 @@

Custom Elements and ECMAScript 6

Input
DOCUMENT, method's context object, a document
TYPE, the custom element type of the element being registered
-
FUNCTION, the custom element constructor function, optional
+
FUNCTION, the custom element constructor, optional
EXTENDS, the local name of an HTML or SVG element that is being extended, optional
Output
CONSTRUCTOR, the custom element constructor
@@ -672,26 +699,24 @@

Custom Elements and ECMAScript 6

  • Let ERROR be the result of running the element registration algorithm with DOCUMENT, TYPE, PROTOTYPE, and NAME as arguments
  • If ERROR is InvalidType, throw a SyntaxError and stop.
  • If ERROR is not None, throw a NotSupportedError and stop.
  • -
  • Return result of running custom element constructor generation algorithm with DOCUMENT and FUNCTION as arguments.
  • +
  • Return result of running custom element constructor generation algorithm with PROTOTYPE, FUNCTION, and DOCUMENT as arguments.
  • - -

    24020: Definition should contain constructor, not the prototype.

    -

    Similarly, the custom element constructor generation algorithm will change as follows:

    Input
    -
    FUNCTION, the custom element constructor function.
    +
    PROTOTYPE, the custom element prototype
    +
    FUNCTION, the custom element constructor
    DOCUMENT, the owner document for new custom element
    Output
    -
    FUNCTION, the mutated custom element constructor function
    +
    FUNCTION, the mutated custom element constructor
    1. If FUNCTION is already an interface object for any interface, throw a NotSupportedError and stop.
    2. -
    3. Let DEFINITION be an element definition that has FUNCTION as custom element prototype
    4. +
    5. Let DEFINITION be an element definition that has PROTOTYPE as custom element prototype
    6. Let CREATE be a function which when called, executes these steps:
      1. Let ELEMENT be the context object