CUSTOM ELEMENTS
A way to build custom fully featured DOM elements providing thus to the parser information on :
- how to properly construct an element
- how to react to life cycle changes on this
Rationalizing the Web platform in concert with existing feature such as HTML elements
Concepts
STEP 1: ELEMENT CREATION:
Creating for the custom element an interface prototype object,
custom element prototype
STEP 2: ELEMENT DEFINITION:
Describing the custom element , custom element definition, which consist of:
- custom element type
- local name
- namespace
- custom element prototype
- life cycle callbacks
STEP 3: ELEMENT REGISTRATION:
Adding a custom element definition to the registry associated to the document to which belong the custom element
STEP 4: ELEMENT INSTANCIATION
STEP 5: ELEMENT INSERTED INTO ACTIVE DOCUMENT
STEP 6: ELEMENT REMOVED FROM ACTIVE DOCUMENT
STEP 7: ELEMENT ATTRIBUTES ADDED, CHANGED, REMOVED
USE CASE: EXTENDING AN EXISTING ELEMENT
Custom elements lifecycle
Various callbacks can be invoked when a custom element goes through its lifecycle.
These calls,lifecycle callbacks, are stored internally as a collection of key-value pairs.
4 types of lifecycle callbacks:
ENQUEUING & INVOKING CALLBACKS:
Creating & passing registries
When a HTML document is loaded in a browsing context, a new registry must be created and associated with this document
REGISTERING CUSTOM ELEMENTS
Because element registration can occur at any time, a custom element could be created before its definition is registered, such elements are called unresolved element.
PARSING CUSTOM ELEMENTS
To enable instant orating custom elements during tree construction, a conforming UA must run enqueue created callbacks whenever creating a custom element.
Algorithms