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).

Behavior Attachment: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
(Formatting tweaks)
(Added purpose.)
Line 6: Line 6:
! width="40%" align="left" | Decorator
! width="40%" align="left" | Decorator
! width="40%" align="left" | Element
! width="40%" align="left" | Element
|-
! align="right" | Purpose
| Give existing content new behavior and/or appearance.
| Create new content building blocks.
|-
|-
! align="right" | Use Cases
! align="right" | Use Cases
Line 11: Line 15:
* Add special UI treatment to all vcards in a document
* Add special UI treatment to all vcards in a document
* Create an extension to provide extra download options for certain types of links
* Create an extension to provide extra download options for certain types of links
| Custom controls (TODO: expand)
|  
* Built-in HTML controls: input/textarea, media, etc.
* Custom controls
|-  
|-  
! align="right" | Identity
! align="right" | Identity

Revision as of 17:55, 4 July 2011

WORK IN PROGRESS

Comparison between the decorator and element behavior attachment.
Decorator Element
Purpose Give existing content new behavior and/or appearance. Create new content building blocks.
Use Cases
  • Add special UI treatment to all vcards in a document
  • Create an extension to provide extra download options for certain types of links
  • Built-in HTML controls: input/textarea, media, etc.
  • Custom controls
Identity Does not change the identity of the element. Creates a new type of element.
Lifetime Transient, added and removed dynamically. Permanent, originates with the element’s creation and exists through the lifetime.
Content Environment Foreign document or limited control of content Full control of content
Shadow Tree Each decorator must have its own shadow subtree, and the aggregate shadow tree of an element is composed out of these subtrees. Only one tree, initialized as the element is created.
DOM API Should avoid adding any extra methods or properties to the DOM element that’s being decorated. Explicitly interested in exposing methods or properties on the DOM element as its API.