| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // WARNING: Do not edit - generated code. | |
| 6 | |
| 7 // TODO(vsm): Eliminate this type. | |
| 8 | |
| 9 // Note, ElementList implements List (instead of List<Element>) so | |
| 10 // that its implementing classes may be cast to Lists of more specific | |
| 11 // type such as List<CanvasElement>. | |
| 12 interface ElementList extends List { | |
| 13 // TODO(jacobr): add element batch manipulation methods. | |
| 14 ElementList filter(bool f(Element element)); | |
| 15 | |
| 16 ElementList getRange(int start, int length); | |
| 17 | |
| 18 Element get first(); | |
| 19 // TODO(jacobr): add insertAt | |
| 20 } | |
| 21 | |
| 22 /** | |
| 23 * All your attribute manipulation needs in one place. | |
| 24 * Extends the regular Map interface by automatically coercing non-string | |
| 25 * values to strings. | |
| 26 */ | |
| 27 interface AttributeMap extends Map<String, String> { | |
| 28 void operator []=(String key, value); | |
| 29 } | |
| 30 | |
| 31 /** | |
| 32 * All your element measurement needs in one place | |
| 33 */ | |
| 34 interface ElementRect { | |
| 35 // Relative to offsetParent | |
| 36 ClientRect get client(); | |
| 37 ClientRect get offset(); | |
| 38 ClientRect get scroll(); | |
| 39 // In global coords | |
| 40 ClientRect get bounding(); | |
| 41 // In global coords | |
| 42 List<ClientRect> get clientRects(); | |
| 43 } | |
| 44 | |
| 45 interface NodeSelector { | |
| 46 Element query(String selectors); | |
| 47 List<Element> queryAll(String selectors); | |
| 48 } | |
| 49 | |
| 50 interface CSSClassSet extends Set<String> { | |
| 51 /** | |
| 52 * Adds the class [token] to the element if it is not on it, removes it if it | |
| 53 * is. | |
| 54 */ | |
| 55 bool toggle(String token); | |
| 56 | |
| 57 /** | |
| 58 * Returns [:true:] classes cannot be added or removed from this | |
| 59 * [:CSSClassSet:]. | |
| 60 */ | |
| 61 bool get isFrozen(); | |
| 62 } | |
| 63 | |
| 64 $!COMMENT | |
| 65 interface Element extends Node, NodeSelector default _$(ID)FactoryProvider { | |
| 66 Element.html(String html); | |
| 67 Element.tag(String tag); | |
| 68 | |
| 69 AttributeMap get attributes(); | |
| 70 void set attributes(Map<String, String> value); | |
| 71 | |
| 72 /** | |
| 73 * @domName childElementCount, firstElementChild, lastElementChild, | |
| 74 * children, Node.nodes.add | |
| 75 */ | |
| 76 ElementList get elements(); | |
| 77 | |
| 78 void set elements(Collection<Element> value); | |
| 79 | |
| 80 /** @domName className, classList */ | |
| 81 CSSClassSet get classes(); | |
| 82 | |
| 83 void set classes(Collection<String> value); | |
| 84 | |
| 85 AttributeMap get dataAttributes(); | |
| 86 void set dataAttributes(Map<String, String> value); | |
| 87 | |
| 88 /** | |
| 89 * Adds the specified text as a text node after the last child of this. | |
| 90 */ | |
| 91 void addText(String text); | |
| 92 | |
| 93 /** | |
| 94 * Parses the specified text as HTML and adds the resulting node after the | |
| 95 * last child of this. | |
| 96 */ | |
| 97 void addHTML(String html); | |
| 98 | |
| 99 /** | |
| 100 * @domName getClientRects, getBoundingClientRect, clientHeight, clientWidth, | |
| 101 * clientTop, clientLeft, offsetHeight, offsetWidth, offsetTop, offsetLeft, | |
| 102 * scrollHeight, scrollWidth, scrollTop, scrollLeft | |
| 103 */ | |
| 104 Future<ElementRect> get rect(); | |
| 105 | |
| 106 /** @domName Window.getComputedStyle */ | |
| 107 Future<CSSStyleDeclaration> get computedStyle(); | |
| 108 | |
| 109 /** @domName Window.getComputedStyle */ | |
| 110 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement); | |
| 111 | |
| 112 Element clone(bool deep); | |
| 113 | |
| 114 Element get parent(); | |
| 115 | |
| 116 $!MEMBERS | |
| 117 } | |
| OLD | NEW |