A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.
To request an account, ping an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members) or send an e-mail to admin@wiki.whatwg.org with your desired username and an explanation of the first edit you'd like to make. (Do not use this e-mail address for any other inquiries, as they will be ignored or politely declined.)
Note: This wiki is used to supplement, not replace, specification discussions. If you would like to request changes to existing specifications, please use IRC or a mailing list first.
Component Model Progressive Enhancement
A. While adding an element to a DOM tree:
- Check for existence of the
becomesattribute. If the attribute exists:- Check the value of the
becomesattribute against the names of already defined elements.- If such element exists, go to step X.
- Otherwise, store a reference to this instance in a "may-become" table.
- Check the value of the
B. When a new element is registered:
- Check to see if there are any instances waiting in the "may-become" table for this element's name
- If so, collect all these instances and, for each instance, go to step X.
C. When the "becomes" attribute is set:
- If the element is in tree, go to step A 1.1.
X. Becoming another element (in Element existing instance).
- Create the element by the name, specified in the
becomesattribute of the existing instance - If the existing instance is already in document tree:
- execute renameNode (or something better) to replace the old element with the newly created element.
- Otherwise, insert newly create element in DOM tree.
- Fire "
become" event on the existing instance. - Set
becameproperty on the existing instance to point to the newly created element.
RolandSteiner Does this mean an author may need to duplicate CSS selectors, e.g., if we have <div becomes="x-foo" class="c"> and a selector div.c, don't we then also need an equivalent selector x-foo.c? OTOH, is it a problem? Perhaps more so in JS with querySelectorAll than in CSS?