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

From WHATWG Wiki
Jump to navigation Jump to search
(Created page with 'A. While adding an element to a DOM tree: # Check for existence of the <code>becomes</code> attribute. If the attribute exists: ## Check the value of the <code>becomes</code> at...')
 
(add question)
Line 19: Line 19:
# Fire "<code>become</code>" event on the existing instance.
# Fire "<code>become</code>" event on the existing instance.
# 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>&lt;div becomes="x-foo" class="c"&gt;</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?

Revision as of 00:36, 29 October 2011

A. While adding an element to a DOM tree:

  1. Check for existence of the becomes attribute. If the attribute exists:
    1. Check the value of the becomes attribute against the names of already defined elements.
      1. If such element exists, go to step X.
      2. Otherwise, store a reference to this instance in a "may-become" table.

B. When a new element is registered:

  1. Check to see if there are any instances waiting in the "may-become" table for this element's name
  2. If so, collect all these instances and, for each instance, go to step X.

C. When the "becomes" attribute is set:

  1. If the element is in tree, go to step A 1.1.

X. Becoming another element (in Element existing instance).

  1. Create the element by the name, specified in the becomes attribute of the existing instance
  2. If the existing instance is already in document tree:
    1. execute renameNode (or something better) to replace the old element with the newly created element.
    2. Otherwise, insert newly create element in DOM tree.
  3. Fire "become" event on the existing instance.
  4. 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?