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

Side by Side Diff: sky/specs/apis.md

Issue 699893005: Specs: Give DocumentFragment and Document a common ancestor that is (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 APIs 1 APIs
2 ==== 2 ====
3 3
4 The Sky core API 4 The Sky core API
5 ---------------- 5 ----------------
6 6
7 ```javascript 7 ```javascript
8 module 'sky:core' { 8 module 'sky:core' {
9 9
10 // EVENTS 10 // EVENTS
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 class Text : Node { 109 class Text : Node {
110 constructor (String value = ''); // O(1) 110 constructor (String value = ''); // O(1)
111 attribute String value; // O(1) 111 attribute String value; // O(1)
112 112
113 void replaceWith(String node); // O(1) // special case override of Node.repl aceWith() 113 void replaceWith(String node); // O(1) // special case override of Node.repl aceWith()
114 114
115 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo p 115 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo p
116 } 116 }
117 117
118 class DocumentFragment : ParentNode { 118 abstract class TreeRoot : ParentNode {
119 Element? findId(String id); // O(1)
120 }
121
122 class DocumentFragment : TreeRoot {
119 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a ll their descendants 123 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a ll their descendants
120 } 124 }
121 125
122 abstract class TreeScope : ParentNode { 126 abstract class TreeScope : TreeRoot {
123 readonly attribute Document? ownerDocument; // O(1) 127 readonly attribute Document? ownerDocument; // O(1)
124 readonly attribute TreeScope? parentScope; // O(1) 128 readonly attribute TreeScope? parentScope; // O(1)
125
126 Element? findId(String id); // O(1)
127 } 129 }
128 130
129 class ShadowRoot : TreeScope { 131 class ShadowRoot : TreeScope {
130 constructor (Element host); // O(1) // note that there is no way in the API to use a newly created ShadowRoot 132 constructor (Element host); // O(1) // note that there is no way in the API to use a newly created ShadowRoot
131 readonly attribute Element host; // O(1) 133 readonly attribute Element host; // O(1)
132 } 134 }
133 135
134 class Document : TreeScope { 136 class Document : TreeScope {
135 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a ll their descendants 137 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a ll their descendants
136 } 138 }
137 139
138 class SelectorQuery { 140 class SelectorQuery {
139 constructor (String selector); // O(F()) where F() is the complexity of the selector 141 constructor (String selector); // O(F()) where F() is the complexity of the selector
140 142
141 Boolean matches(Element element); // O(F()) 143 Boolean matches(Element element); // O(F())
142 Element? find(ParentNode root); // O(N*F()) where N is the number of descend ants 144 Element? find(Element root); // O(N*F())+O(M) where N is the number of desce ndants and M the average depth of the tree
143 Array<Element> findAll(ParentNode root); // O(N*F()) where N is the number o f descendants 145 Element? find(TreeRoot root); // O(N*F()) where N is the number of descendan ts
146 Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the numb er of descendants and M the average depth of the tree
147 Array<Element> findAll(TreeRoot root); // O(N*F()) where N is the number of descendants
144 } 148 }
145 149
146 150
147 // BUILT-IN ELEMENTS 151 // BUILT-IN ELEMENTS
148 152
149 class ImportElement : Element { 153 class ImportElement : Element {
150 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 154 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants
151 constructor (ChildArguments... nodes); // shorthand 155 constructor (ChildArguments... nodes); // shorthand
152 constructor (Dictionary attributes); // shorthand 156 constructor (Dictionary attributes); // shorthand
153 constructor (); // shorthand 157 constructor (); // shorthand
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 the core mojo fabric JS API sky:mojo:fabric:core 492 the core mojo fabric JS API sky:mojo:fabric:core
489 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc 493 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc
490 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell 494 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell
491 the sky API sky:core 495 the sky API sky:core
492 the sky debug symbols for private APIs sky:debug 496 the sky debug symbols for private APIs sky:debug
493 ``` 497 ```
494 498
495 TODO(ianh): determine if we want to separate the "this" from the 499 TODO(ianh): determine if we want to separate the "this" from the
496 Document, especially for Modules, so that exposing a module's element 500 Document, especially for Modules, so that exposing a module's element
497 doesn't expose the module's exports attribute. 501 doesn't expose the module's exports attribute.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698