Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/README.md

Issue 2828643002: Make customElements.define faster
Patch Set: Try to make Android builder happy. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Custom Elements 1 # Custom Elements
2 2
3 Custom elements let authors create their own elements, with their own 3 Custom elements let authors create their own elements, with their own
4 methods, behavior, and attribute handling. Custom elements shipped in 4 methods, behavior, and attribute handling. Custom elements shipped in
5 M33. We colloquially refer to that version as "v0." 5 M33. We colloquially refer to that version as "v0."
6 6
7 Contact Dominic Cooney 7 Contact Dominic Cooney
8 ([dominicc@chromium.org](mailto:dominicc@chromium.org)) with 8 ([dominicc@chromium.org](mailto:dominicc@chromium.org)) with
9 questions. 9 questions.
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 ###### V8HTMLElement Constructor 45 ###### V8HTMLElement Constructor
46 46
47 The `HTMLElement` interface constructor. When a custom element is 47 The `HTMLElement` interface constructor. When a custom element is
48 created from JavaScript all we have to go on is the constructor (in 48 created from JavaScript all we have to go on is the constructor (in
49 `new.target`); this uses ScriptCustomElementDefinition's state to find 49 `new.target`); this uses ScriptCustomElementDefinition's state to find
50 the definition to use. 50 the definition to use.
51 51
52 ### Memory Management 52 ### Memory Management
53 53
54 Once defined, custom element constructors and prototypes have to be 54 CustomElementRegistry
55 kept around indefinitely because they could be created in future by 55 implements
56 the parser. On the other hand, we must not leak when a window can no 56 [wrapper tracing](../../../bindings/core/v8/TraceWrapperReference.md)
57 longer run script.
58 57
59 We use a V8HiddenValue on the CustomElementRegistry wrapper which 58 CustomElementDefinition, ScriptCustomElementDefinition hold onto the
60 points to a map that keeps constructors and prototypes alive. See 59 callbacks, etc. directly. They become TraceWrapperBase.
61 ScriptCustomElementDefinition. 60
61 Each V8PerContextData has a V8PrivateProperty identifying the custom
62 element. The private property stores an int index into the
63 CustomElementsRegistry list of definitions.
62 64
63 ## Style Guide 65 ## Style Guide
64 66
65 In comments and prose, write custom elements, not Custom Elements, to 67 In comments and prose, write custom elements, not Custom Elements, to
66 match the HTML standard. 68 match the HTML standard.
67 69
68 Prefix type names with CustomElement (singular). 70 Prefix type names with CustomElement (singular).
69 71
70 ## Testing 72 ## Testing
71 73
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 may remove it even sooner, if we have evidence that sites are using 149 may remove it even sooner, if we have evidence that sites are using
148 feature detection correctly. 150 feature detection correctly.
149 151
150 ## References 152 ## References
151 153
152 These have links to the parts of the DOM and HTML specs which define 154 These have links to the parts of the DOM and HTML specs which define
153 custom elements: 155 custom elements:
154 156
155 * [WHATWG DOM Wiki: Custom Elements](https://github.com/whatwg/dom/wiki#custom-e lements) 157 * [WHATWG DOM Wiki: Custom Elements](https://github.com/whatwg/dom/wiki#custom-e lements)
156 * [WHATWG HTML Wiki: Custom Elements](https://github.com/whatwg/html/wiki#custom -elements) 158 * [WHATWG HTML Wiki: Custom Elements](https://github.com/whatwg/html/wiki#custom -elements)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698