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
Jump to navigation
Jump to search
No edit summary |
(Formatting tweaks) |
||
Line 4: | Line 4: | ||
|+ Comparison between the decorator and element behavior attachment. | |+ Comparison between the decorator and element behavior attachment. | ||
! width="10%" | | ! width="10%" | | ||
! width="40%" | Decorator | ! width="40%" align="left" | Decorator | ||
! width="40%" | Element | ! width="40%" align="left" | Element | ||
|- | |- | ||
! Use Cases | ! align="right" | Use Cases | ||
| | | | ||
* Add special UI treatment to all vcards in a document | * Add special UI treatment to all vcards in a document | ||
Line 13: | Line 13: | ||
| Custom controls (TODO: expand) | | Custom controls (TODO: expand) | ||
|- | |- | ||
! Identity | ! align="right" | Identity | ||
| Does not change the identity of the element. | | Does not change the identity of the element. | ||
| Creates a new type of element. | | Creates a new type of element. | ||
|- | |- | ||
! Lifetime | ! align="right" | Lifetime | ||
| Transient, added and removed dynamically. | | Transient, added and removed dynamically. | ||
| Permanent, originates with the element’s creation and exists through the lifetime. | | Permanent, originates with the element’s creation and exists through the lifetime. | ||
|- | |- | ||
! Content Environment | ! align="right" | Content Environment | ||
| Foreign document or limited control of content | | Foreign document or limited control of content | ||
| Full control | | Full control of content | ||
|- | |- | ||
! Shadow Tree | ! align="right" | Shadow Tree | ||
| Each decorator must have its own shadow subtree, and the aggregate shadow tree of an element is composed out of these subtrees. | | 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. | | Only one tree, initialized as the element is created. | ||
|- | |- | ||
! DOM API | ! align="right" | DOM API | ||
| Should avoid adding any extra methods or properties to the DOM element that’s being decorated. | | 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. | | Explicitly interested in exposing methods or properties on the DOM element as its API. | ||
|} | |} |
Revision as of 17:42, 4 July 2011
WORK IN PROGRESS
Decorator | Element | |
---|---|---|
Use Cases |
|
Custom controls (TODO: expand) |
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. |