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

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

Issue 944873007: Specs: define how importing element registrations works, move built-in elements to a separate modul… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | sky/specs/events.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Sky DOM APIs 1 Sky DOM APIs
2 ============ 2 ============
3 3
4 ```dart 4 ```dart
5 SKY MODULE
6 <!-- part of dart:sky -->
7
8 <script>
9 // ELEMENT TREE API 5 // ELEMENT TREE API
10 6
11 abstract class Node extends EventTarget { 7 abstract class Node extends EventTarget {
12 @override 8 @override
13 external List<EventTarget> getEventDispatchChain(); // O(N) in number of ances tors across shadow trees 9 external List<EventTarget> getEventDispatchChain(); // O(N) in number of ances tors across shadow trees
14 // implements EventTarget.getEventDispatchChain() 10 // implements EventTarget.getEventDispatchChain()
15 // returns the event dispatch chain (including handling shadow trees) 11 // returns the event dispatch chain (including handling shadow trees)
16 12
17 external Root get owner; // O(1) 13 external Root get owner; // O(1)
18 14
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 267
272 class ApplicationRoot extends Root { 268 class ApplicationRoot extends Root {
273 ApplicationRoot ({List children}) : super(children: children); // O(N) in numb er of children nodes arguments plus all their descendants 269 ApplicationRoot ({List children}) : super(children: children); // O(N) in numb er of children nodes arguments plus all their descendants
274 270
275 @override 271 @override
276 Type getLayoutManager() => rootLayoutManager; // O(1) 272 Type getLayoutManager() => rootLayoutManager; // O(1)
277 } 273 }
278 274
279 Type rootLayoutManager = BlockLayoutManager; // O(1) 275 Type rootLayoutManager = BlockLayoutManager; // O(1)
280 276
281
282 // BUILT-IN ELEMENTS
283
284 @tagname('import')
285 class ImportElement extends Element {
286 ImportElement = Element;
287
288 @override
289 Type getLayoutManager() => null; // O(1)
290 }
291
292 @tagname('template')
293 class TemplateElement extends Element {
294 TemplateElement = Element;
295
296 // TODO(ianh): convert <template> to using a token stream instead of a Fragmen t
297
298 external Fragment get content; // O(1)
299
300 @override
301 Type getLayoutManager() => null; // O(1)
302 }
303
304 @tagname('script')
305 class ScriptElement extends Element {
306 ScriptElement = Element;
307
308 @override
309 Type getLayoutManager() => null; // O(1)
310 }
311
312 @tagname('style')
313 class StyleElement extends Element {
314 StyleElement = Element;
315
316 external List<Rule> getRules(); // O(N) in rules
317
318 @override
319 Type getLayoutManager() => null; // O(1)
320 }
321
322 @tagname('content')
323 class ContentElement extends Element {
324 ContentElement = Element;
325
326 external List<Node> getDistributedNodes(); // O(N) in distributed nodes
327
328 @override
329 Type getLayoutManager() => null; // O(1)
330 }
331
332 @tagname('img')
333 class ImgElement extends Element {
334 ImgElement = Element;
335
336 @override
337 Type getLayoutManager() => ImgElementLayoutManager; // O(1)
338 }
339
340 @tagname('div')
341 class DivElement extends Element {
342 DivElement = Element;
343 }
344
345 @tagname('span')
346 class SpanElement extends Element {
347 SpanElement = Element;
348 }
349
350 @tagname('iframe')
351 class IframeElement extends Element {
352 IframeElement = Element;
353
354 @override
355 Type getLayoutManager() => IframeElementLayoutManager; // O(1)
356 }
357
358 @tagname('t')
359 class TElement extends Element {
360 TElement = Element;
361 }
362
363 @tagname('a')
364 class AElement extends Element {
365 AElement = Element;
366 }
367
368 @tagname('title')
369 class TitleElement extends Element {
370 TitleElement = Element;
371
372 @override
373 Type getLayoutManager() => null; // O(1)
374 }
375
376 class _ErrorElement extends Element {
377 _ErrorElement._create();
378
379 @override
380 Type getLayoutManager() => _ErrorElementLayoutManager; // O(1)
381 }
382
383 class SelectorQuery { 277 class SelectorQuery {
384 external SelectorQuery(String selector); // O(F()) where F() is the complexity of the selector 278 external SelectorQuery(String selector); // O(F()) where F() is the complexity of the selector
385 279
386 external bool matches(Element element); // O(F()) 280 external bool matches(Element element); // O(F())
387 external Element find(Node root); // O(N*F())+O(M) where N is the number of de scendants and M the average depth of the tree 281 external Element find(Node root); // O(N*F())+O(M) where N is the number of de scendants and M the average depth of the tree
388 external List<Element> findAll(Node root); // O(N*F())+O(N*M) where N is the n umber of descendants and M the average depth of the tree 282 external List<Element> findAll(Node root); // O(N*F())+O(N*M) where N is the n umber of descendants and M the average depth of the tree
389 // find() and findAll() throw if the root is not one of the following: 283 // find() and findAll() throw if the root is not one of the following:
390 // - Element 284 // - Element
391 // - Fragment 285 // - Fragment
392 // - Root 286 // - Root
393 } 287 }
394 </script>
395 ``` 288 ```
OLDNEW
« no previous file with comments | « no previous file | sky/specs/events.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698