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, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).
Component Model Progressive Enhancement: Difference between revisions
Jump to navigation
Jump to search
(add question) |
No edit summary |
||
Line 20: | Line 20: | ||
# Set <code>became</code> property on the existing instance to point to the newly created element. | # Set <code>became</code> property on the existing instance to point to the newly created element. | ||
[[User:Rolandsteiner|RolandSteiner]] Does this mean an author may need to duplicate CSS selectors, e.g., if we have <tt><div becomes="x-foo" class="c"></tt> and a selector <tt>div.c</tt>, don't we then also need an equivalent selector <tt>x-foo.c</tt>? OTOH, is it a problem? | [[User:Rolandsteiner|RolandSteiner]] Does this mean an author may need to duplicate CSS selectors, e.g., if we have <tt><div becomes="x-foo" class="c"></tt> and a selector <tt>div.c</tt>, don't we then also need an equivalent selector <tt>x-foo.c</tt>? OTOH, is it a problem? Perhaps more so in JS with querySelectorAll than in CSS? |
Latest revision as of 00:37, 29 October 2011
A. While adding an element to a DOM tree:
- Check for existence of the
becomes
attribute. If the attribute exists:- Check the value of the
becomes
attribute 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
becomes
attribute 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
became
property 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?