| OLD | NEW |
| 1 Sky DOM APIs | 1 Sky DOM APIs |
| 2 ============ | 2 ============ |
| 3 | 3 |
| 4 ```javascript | 4 ```javascript |
| 5 | 5 |
| 6 // DOM | 6 // DOM |
| 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void insertAfter(ChildArgument... nodes); // O(N) in number of arguments plus
all their descendants | 24 void insertAfter(ChildArgument... nodes); // O(N) in number of arguments plus
all their descendants |
| 25 void replaceWith(ChildArgument... nodes); // O(N) in number of descendants plu
s arguments plus all their descendants | 25 void replaceWith(ChildArgument... nodes); // O(N) in number of descendants plu
s arguments plus all their descendants |
| 26 void remove(); // O(N) in number of descendants | 26 void remove(); // O(N) in number of descendants |
| 27 Node cloneNode(Boolean deep = false); // O(1) if deep=false, O(N) in the numbe
r of descendants if deep=true | 27 Node cloneNode(Boolean deep = false); // O(1) if deep=false, O(N) in the numbe
r of descendants if deep=true |
| 28 | 28 |
| 29 // called when parentNode changes | 29 // called when parentNode changes |
| 30 virtual void parentChangeCallback(ParentNode? oldParent, ParentNode? newParent
, ChildNode? previousSibling, ChildNode? nextSibling); // O(N) in descendants (c
alls attached/detached) | 30 virtual void parentChangeCallback(ParentNode? oldParent, ParentNode? newParent
, ChildNode? previousSibling, ChildNode? nextSibling); // O(N) in descendants (c
alls attached/detached) |
| 31 virtual void attachedCallback(); // noop | 31 virtual void attachedCallback(); // noop |
| 32 virtual void detachedCallback(); // noop | 32 virtual void detachedCallback(); // noop |
| 33 | 33 |
| 34 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of in
sertion points the node is in |
| 35 // returns the <content> elements to which this element was distributed |
| 36 |
| 34 readonly attribute ElementStyleDeclarationList? style; // O(1) | 37 readonly attribute ElementStyleDeclarationList? style; // O(1) |
| 35 // for nodes that aren't reachable from the Application Document, returns nu
ll | 38 // for nodes that aren't reachable from the Application Document, returns nu
ll |
| 36 // (so in particular orphaned subtrees and nodes in module documents don't h
ave one) | 39 // (so in particular orphaned subtrees and nodes in module documents don't h
ave one) |
| 37 // -- should be updated when the node's parent chain changes (same time as,
e.g., | 40 // -- should be updated when the node's parent chain changes (same time as,
e.g., |
| 38 // the id hashtable is updated) | 41 // the id hashtable is updated) |
| 39 // also always returns null for ContentElement elements and ShadowRoot nodes | 42 // also always returns null for ContentElement elements and ShadowRoot nodes |
| 40 readonly attribute RenderNode? renderNode; // O(1) | 43 readonly attribute RenderNode? renderNode; // O(1) |
| 41 // this will be null until the first time it is rendered | 44 // this will be null until the first time it is rendered |
| 42 // it becomes null again when it is taken out of the rendering (see style.md
) | 45 // it becomes null again when it is taken out of the rendering (see style.md
) |
| 43 abstract virtual LayoutManagerConstructor getLayoutManager(); // O(1) | 46 abstract virtual LayoutManagerConstructor getLayoutManager(); // O(1) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 | 74 |
| 72 Boolean hasAttribute(String name); // O(N) in number of attributes | 75 Boolean hasAttribute(String name); // O(N) in number of attributes |
| 73 String getAttribute(String name); // O(N) in number of attributes | 76 String getAttribute(String name); // O(N) in number of attributes |
| 74 void setAttribute(String name, String value = ''); // O(N) in number of attrib
utes | 77 void setAttribute(String name, String value = ''); // O(N) in number of attrib
utes |
| 75 void removeAttribute(String name); // O(N) in number of attributes | 78 void removeAttribute(String name); // O(N) in number of attributes |
| 76 | 79 |
| 77 // Returns a new Array and new Attr instances every time. | 80 // Returns a new Array and new Attr instances every time. |
| 78 Array<Attr> getAttributes(); // O(N) in number of attributes | 81 Array<Attr> getAttributes(); // O(N) in number of attributes |
| 79 | 82 |
| 80 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow root
// TODO(ianh): Should this be mutable? It would help explain how it gets set... | 83 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow root
// TODO(ianh): Should this be mutable? It would help explain how it gets set... |
| 81 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of in
sertion points the node is in | |
| 82 | 84 |
| 83 virtual void endTagParsedCallback(); // noop | 85 virtual void endTagParsedCallback(); // noop |
| 84 virtual void attributeChangeCallback(String name, String? oldValue, String? ne
wValue); // noop | 86 virtual void attributeChangeCallback(String name, String? oldValue, String? ne
wValue); // noop |
| 85 // TODO(ianh): does a node ever need to know when it's been redistributed? | 87 // TODO(ianh): does a node ever need to know when it's been redistributed? |
| 86 | 88 |
| 87 virtual LayoutManagerConstructor getLayoutManager(); // O(1) | 89 virtual LayoutManagerConstructor getLayoutManager(); // O(1) |
| 88 // default implementation looks up the 'display' property and returns the va
lue: | 90 // default implementation looks up the 'display' property and returns the va
lue: |
| 89 // if (renderNode) | 91 // if (renderNode) |
| 90 // return renderNode.getProperty(phDisplay); | 92 // return renderNode.getProperty(phDisplay); |
| 91 // return null; | 93 // return null; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 284 |
| 283 Boolean matches(Element element); // O(F()) | 285 Boolean matches(Element element); // O(F()) |
| 284 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 | 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 |
| 285 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 | 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 |
| 286 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant
s | 288 Element? find(TreeScope root); // O(N*F()) where N is the number of descendant
s |
| 287 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 | 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 |
| 288 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 | 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 |
| 289 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d
escendants | 291 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of d
escendants |
| 290 } | 292 } |
| 291 ``` | 293 ``` |
| OLD | NEW |