| OLD | NEW |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 readonly attribute String tagName; // O(1) | 91 readonly attribute String tagName; // O(1) |
| 92 | 92 |
| 93 Boolean hasAttribute(String name); // O(N) in arguments | 93 Boolean hasAttribute(String name); // O(N) in arguments |
| 94 String getAttribute(String name); // O(N) in arguments | 94 String getAttribute(String name); // O(N) in arguments |
| 95 void setAttribute(String name, String value); // O(N) in arguments | 95 void setAttribute(String name, String value); // O(N) in arguments |
| 96 void removeAttribute(String name); // O(N) in arguments | 96 void removeAttribute(String name); // O(N) in arguments |
| 97 | 97 |
| 98 // Returns a new Array and new Attr instances every time. | 98 // Returns a new Array and new Attr instances every time. |
| 99 Array<Attr> getAttributes(); // O(N) in arguments | 99 Array<Attr> getAttributes(); // O(N) in arguments |
| 100 | 100 |
| 101 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the youngest s
hadow root | 101 readonly attribute ShadowRoot? shadowRoot; // O(1) // returns the shadow roo
t |
| 102 void addShadowRoot(ShadowRoot root); // O(N) in descendants of argument | |
| 103 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of
insertion points the node is in | 102 Array<ContentElement> getDestinationInsertionPoints(); // O(N) in number of
insertion points the node is in |
| 104 | 103 |
| 105 virtual void attributeChangeCallback(String name, String? oldValue, String?
newValue); // noop | 104 virtual void attributeChangeCallback(String name, String? oldValue, String?
newValue); // noop |
| 106 virtual void shadowRootChangeCallback(ShadowRoot root); // noop | |
| 107 // TODO(ianh): does a node ever need to know when it's been redistributed? | 105 // TODO(ianh): does a node ever need to know when it's been redistributed? |
| 108 } | 106 } |
| 109 Element createElement(String tagName, Dictionary attributes, ChildArguments...
nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their
descendants | 107 Element createElement(String tagName, Dictionary attributes, ChildArguments...
nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their
descendants |
| 110 Element createElement(String tagName, Dictionary attributes); // shorthand | 108 Element createElement(String tagName, Dictionary attributes); // shorthand |
| 111 Element createElement(String tagName, ChildArguments... nodes); // shorthand | 109 Element createElement(String tagName, ChildArguments... nodes); // shorthand |
| 112 Element createElement(String tagName); // shorthand | 110 Element createElement(String tagName); // shorthand |
| 113 | 111 |
| 114 Object registerElement(String tagName, Object interfaceObject); // O(N) in num
ber of outstanding elements with that tag name to be upgraded | 112 dictionary ElementRegistration { |
| 113 String tagName; |
| 114 Boolean shadow; |
| 115 Object prototype; |
| 116 } |
| 117 Object registerElement(ElementRegistration options); // O(N) in number of outs
tanding elements with that tag name to be upgraded |
| 115 | 118 |
| 116 interface Text : Node { | 119 interface Text : Node { |
| 117 constructor (String value); // O(1) | 120 constructor (String value); // O(1) |
| 118 attribute String value; // O(1) | 121 attribute String value; // O(1) |
| 119 | 122 |
| 120 void replaceWith(String node); // O(1) // special case override of Node.repl
aceWith() | 123 void replaceWith(String node); // O(1) // special case override of Node.repl
aceWith() |
| 121 | 124 |
| 122 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo
p | 125 virtual void valueChangeCallback(String? oldValue, String? newValue); // noo
p |
| 123 } | 126 } |
| 124 | 127 |
| 125 interface DocumentFragment : ParentNode { | 128 interface DocumentFragment : ParentNode { |
| 126 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a
ll their descendants | 129 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a
ll their descendants |
| 127 } | 130 } |
| 128 | 131 |
| 129 abstract interface TreeScope : ParentNode { | 132 abstract interface TreeScope : ParentNode { |
| 130 readonly attribute Document? ownerDocument; // O(1) | 133 readonly attribute Document? ownerDocument; // O(1) |
| 131 readonly attribute TreeScope? parentScope; // O(1) | 134 readonly attribute TreeScope? parentScope; // O(1) |
| 132 | 135 |
| 133 Element? findId(String id); // O(1) | 136 Element? findId(String id); // O(1) |
| 134 } | 137 } |
| 135 | 138 |
| 136 interface ShadowRoot : TreeScope { | 139 interface ShadowRoot : TreeScope { |
| 137 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a
ll their descendants | 140 constructor (Element host); // O(1) // note that there is no way in the API
to use a newly created ShadowRoot |
| 138 readonly attribute Element? host; // O(1) | 141 readonly attribute Element host; // O(1) |
| 139 readonly attribute ShadowRoot? olderShadowRoot; // O(1) | |
| 140 void removeShadowRoot(); // O(N) in descendants | |
| 141 } | 142 } |
| 142 | 143 |
| 143 interface Document : TreeScope { | 144 interface Document : TreeScope { |
| 144 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a
ll their descendants | 145 constructor (ChildArguments... nodes); // O(N) in number of arguments plus a
ll their descendants |
| 145 } | 146 } |
| 146 | 147 |
| 147 interface SelectorQuery { | 148 interface SelectorQuery { |
| 148 constructor (String selector); // O(F()) where F() is the complexity of the
selector | 149 constructor (String selector); // O(F()) where F() is the complexity of the
selector |
| 149 | 150 |
| 150 Boolean matches(Element element); // O(F()) | 151 Boolean matches(Element element); // O(F()) |
| 151 Element? find(ParentNode root); // O(N*F()) where N is the number of descend
ants | 152 Element? find(ParentNode root); // O(N*F()) where N is the number of descend
ants |
| 152 Array<Element> findAll(ParentNode root); // O(N*F()) where N is the number o
f descendants | 153 Array<Element> findAll(ParentNode root); // O(N*F()) where N is the number o
f descendants |
| 153 } | 154 } |
| 154 | 155 |
| 155 // Built-in Elements | 156 // Built-in Elements |
| 156 interface ImportElement : Element { } | 157 interface ImportElement : Element { } |
| 157 interface TemplateElement : Element { | 158 interface TemplateElement : Element { |
| 158 readonly attribute DocumentFragment content; // O(1) | 159 readonly attribute DocumentFragment content; // O(1) |
| 159 } | 160 } |
| 160 interface ScriptElement : Element { } | 161 interface ScriptElement : Element { } |
| 161 interface StyleElement : Element { } | 162 interface StyleElement : Element { } |
| 162 interface ContentElement : Element { | 163 interface ContentElement : Element { |
| 163 Array<Node> getDistributedNodes(); // O(N) in distributed nodes | 164 Array<Node> getDistributedNodes(); // O(N) in distributed nodes |
| 164 } | 165 } |
| 165 interface ShadowElement : Element { | |
| 166 Array<Node> getDistributedNodes(); // O(N) in distributed nodes | |
| 167 } | |
| 168 interface ImgElement : Element { } | 166 interface ImgElement : Element { } |
| 169 interface IframeElement : Element { } | 167 interface IframeElement : Element { } |
| 170 interface TElement : Element { } | 168 interface TElement : Element { } |
| 171 interface AElement : Element { } | 169 interface AElement : Element { } |
| 172 interface TitleElement : Element { } | 170 interface TitleElement : Element { } |
| 173 | 171 |
| 174 | 172 |
| 175 | 173 |
| 176 // MODULES | 174 // MODULES |
| 177 abstract interface AbstractModule : EventTarget { | 175 abstract interface AbstractModule : EventTarget { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // private APIs - see below | 258 // private APIs - see below |
| 261 private void method(); | 259 private void method(); |
| 262 | 260 |
| 263 // arguments and overloading are done as follows | 261 // arguments and overloading are done as follows |
| 264 // note that the argument names are only for documentation purposes | 262 // note that the argument names are only for documentation purposes |
| 265 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2); | 263 ReturnType method(ArgumentType argumentName1, ArgumentType argumentName2); |
| 266 // the last argument's type can have "..." appended to it to indicate a vara
rgs-like situation | 264 // the last argument's type can have "..." appended to it to indicate a vara
rgs-like situation |
| 267 ReturnType method(ArgumentType argumentName1, ArgumentType... allSubsequentA
rguments); | 265 ReturnType method(ArgumentType argumentName1, ArgumentType... allSubsequentA
rguments); |
| 268 } | 266 } |
| 269 | 267 |
| 268 dictionary Options { |
| 269 String foo; |
| 270 Integer bar; |
| 271 } |
| 272 |
| 270 // the module can have properties and methods also | 273 // the module can have properties and methods also |
| 271 attribute String Foo; | 274 attribute String Foo; |
| 272 void method(); | 275 void method(); |
| 273 | 276 |
| 274 } | 277 } |
| 275 ``` | 278 ``` |
| 276 | 279 |
| 277 ### Private APIs ### | 280 ### Private APIs ### |
| 278 | 281 |
| 279 Private APIs are only accessible via Symbol objects, which are then | 282 Private APIs are only accessible via Symbol objects, which are then |
| (...skipping 22 matching lines...) Expand all Loading... |
| 302 ### Types ### | 305 ### Types ### |
| 303 | 306 |
| 304 The following types are available: | 307 The following types are available: |
| 305 | 308 |
| 306 * ``Integer`` - WebIDL ``long long`` | 309 * ``Integer`` - WebIDL ``long long`` |
| 307 * ``Float`` - WebIDL ``double`` | 310 * ``Float`` - WebIDL ``double`` |
| 308 * ``String`` - WebIDL ``USVString`` | 311 * ``String`` - WebIDL ``USVString`` |
| 309 * ``Boolean`` - WebIDL ``boolean`` | 312 * ``Boolean`` - WebIDL ``boolean`` |
| 310 # ``Object`` - WebIDL ``object`` | 313 # ``Object`` - WebIDL ``object`` |
| 311 * ``InterfaceName`` - an instance of the interface InterfaceName | 314 * ``InterfaceName`` - an instance of the interface InterfaceName |
| 315 * ``DictionaryName`` - an instance of the dictionary DictionaryName |
| 312 * ``Promise<Type>`` - WebIDL ``Promise<T>`` | 316 * ``Promise<Type>`` - WebIDL ``Promise<T>`` |
| 313 * ``Array<Type>`` - WebIDL ``sequence<T>`` | 317 * ``Array<Type>`` - WebIDL ``sequence<T>`` |
| 314 * ``Dictionary`` - unordered set of name-value String-String pairs with no dupli
cate names | 318 * ``Dictionary`` - unordered set of name-value String-String pairs with no dupli
cate names |
| 315 * ``Type?`` - union of Type and the singleton type with value "null" (WebIDL nul
lable) | 319 * ``Type?`` - union of Type and the singleton type with value "null" (WebIDL nul
lable) |
| 316 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union) | 320 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union) |
| 317 * ``any`` - union of all types (WebIDL ``any``) | 321 * ``any`` - union of all types (WebIDL ``any``) |
| 318 | 322 |
| 319 Methods that return nothing (undefined, in JS) use the keyword "void" | 323 Methods that return nothing (undefined, in JS) use the keyword "void" |
| 320 instead of a type. | 324 instead of a type. |
| 321 | 325 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 345 the core mojo fabric JS API sky:mojo:fabric:core | 349 the core mojo fabric JS API sky:mojo:fabric:core |
| 346 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc | 350 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj
o:fabric:ipc |
| 347 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell | 351 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp
osed sky:mojo:shell |
| 348 the sky API sky:core | 352 the sky API sky:core |
| 349 the sky debug symbols for private APIs sky:debug | 353 the sky debug symbols for private APIs sky:debug |
| 350 ``` | 354 ``` |
| 351 | 355 |
| 352 TODO(ianh): determine if we want to separate the "this" from the | 356 TODO(ianh): determine if we want to separate the "this" from the |
| 353 Document, especially for Modules, so that exposing a module's element | 357 Document, especially for Modules, so that exposing a module's element |
| 354 doesn't expose the module's exports attribute. | 358 doesn't expose the module's exports attribute. |
| OLD | NEW |