| OLD | NEW |
| 1 Sky DOM APIs | 1 Sky DOM APIs |
| 2 ============ | 2 ============ |
| 3 | 3 |
| 4 ```javascript | 4 ```javascript |
| 5 | 5 |
| 6 // DOM | 6 // Element Tree |
| 7 | 7 |
| 8 typedef ChildNode (Element or Text); | 8 typedef ChildNode (Element or Text); |
| 9 typedef ChildArgument (Element or Text or String); | 9 typedef ChildArgument (Element or Text or String); |
| 10 | 10 |
| 11 abstract class Node : EventTarget { // implemented in C++ | 11 abstract class Node : EventTarget { // implemented in C++ |
| 12 readonly attribute TreeScope? ownerScope; // O(1) | 12 readonly attribute TreeScope? ownerScope; // O(1) |
| 13 | 13 |
| 14 readonly attribute ParentNode? parentNode; // O(1) | 14 readonly attribute ParentNode? parentNode; // O(1) |
| 15 readonly attribute Element? parentElement; // O(1) // if parentNode isn't an e
lement, returns null | 15 readonly attribute Element? parentElement; // O(1) // if parentNode isn't an e
lement, returns null |
| 16 readonly attribute ChildNode? previousSibling; // O(1) | 16 readonly attribute ChildNode? previousSibling; // O(1) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Element? findId(String id); // O(1) | 116 Element? findId(String id); // O(1) |
| 117 } | 117 } |
| 118 | 118 |
| 119 class ShadowRoot : TreeScope { | 119 class ShadowRoot : TreeScope { |
| 120 constructor (Element host); // O(1) // note that there is no way in the API to
use a newly created ShadowRoot | 120 constructor (Element host); // O(1) // note that there is no way in the API to
use a newly created ShadowRoot |
| 121 readonly attribute Element host; // O(1) | 121 readonly attribute Element host; // O(1) |
| 122 } | 122 } |
| 123 | 123 |
| 124 class Document : TreeScope { | 124 class Document : TreeScope { |
| 125 constructor (ChildArguments... nodes); // O(N) in number of arguments plus all
their descendants | 125 constructor (ChildArguments... nodes); // O(N) in number of arguments plus all
their descendants |
| 126 } |
| 127 |
| 128 class ApplicationDocument : Document { |
| 129 constructor (GestureManager gestureManager, ChildArguments... nodes); // O(N)
in number of /nodes/ arguments plus all their descendants |
| 126 | 130 |
| 127 virtual LayoutManagerConstructor getLayoutManager(); // O(1) | 131 virtual LayoutManagerConstructor getLayoutManager(); // O(1) |
| 128 // returns sky.rootLayoutManager; | 132 // returns sky.rootLayoutManager; |
| 133 |
| 134 readonly attribute GestureManager gestureManager; |
| 129 } | 135 } |
| 130 | 136 |
| 131 attribute LayoutManagerConstructor rootLayoutManager; // O(1) | 137 attribute LayoutManagerConstructor rootLayoutManager; // O(1) |
| 132 // initially configured to return BlockLayoutManager | 138 // initially configured to return BlockLayoutManager |
| 133 | 139 |
| 134 | 140 |
| 135 // BUILT-IN ELEMENTS | 141 // BUILT-IN ELEMENTS |
| 136 | 142 |
| 137 class ImportElement : Element { | 143 class ImportElement : Element { |
| 138 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N
), M = number of attributes, N = number of nodes plus all their descendants | 144 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M+N
), M = number of attributes, N = number of nodes plus all their descendants |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 290 |
| 285 Boolean matches(Element element); // O(F()) | 291 Boolean matches(Element element); // O(F()) |
| 286 Element? find(Element root); // O(N*F())+O(M) where N is the number of descend
ants and M the average depth of the tree | 292 Element? find(Element root); // O(N*F())+O(M) where N is the number of descend
ants and M the average depth of the tree |
| 287 Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number o
f descendants and M the average depth of the tree | 293 Element? find(DocumentFragment root); // O(N*F())+O(M) where N is the number o
f descendants and M the average depth of the tree |
| 288 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant
s | 294 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant
s |
| 289 Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the number
of descendants and M the average depth of the tree | 295 Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the number
of descendants and M the average depth of the tree |
| 290 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is t
he number of descendants and M the average depth of the tree | 296 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is t
he number of descendants and M the average depth of the tree |
| 291 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d
escendants | 297 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d
escendants |
| 292 } | 298 } |
| 293 ``` | 299 ``` |
| OLD | NEW |