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

Side by Side Diff: client/html/src/ElementWrappingImplementation.dart

Issue 9537001: Generate dart:html bindings for Dartium as well as Frog. All unittests now pass (or are disabled fo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(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 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality.
6 class _ChildrenElementList implements ElementList {
7 // Raw Element.
8 final _element;
9 final _childElements;
10
11 _ChildrenElementList._wrap(var element)
12 : _childElements = element.children,
13 _element = element;
14
15 List<Element> _toList() {
16 final output = new List(_childElements.length);
17 for (int i = 0, len = _childElements.length; i < len; i++) {
18 output[i] = LevelDom.wrapElement(_childElements[i]);
19 }
20 return output;
21 }
22
23 Element get first() {
24 return LevelDom.wrapElement(_element.firstElementChild);
25 }
26
27 void forEach(void f(Element element)) => _toList().forEach(f);
28
29 Collection map(f(Element element)) => _toList().map(f);
30
31 ElementList filter(bool f(Element element)) =>
32 new _ElementList(_toList().filter(f));
33
34 bool every(bool f(Element element)) {
35 for(Element element in this) {
36 if (!f(element)) {
37 return false;
38 }
39 };
40 return true;
41 }
42
43 bool some(bool f(Element element)) {
44 for(Element element in this) {
45 if (f(element)) {
46 return true;
47 }
48 };
49 return false;
50 }
51
52 bool isEmpty() {
53 return _element.firstElementChild === null;
54 }
55
56 int get length() {
57 return _childElements.length;
58 }
59
60 Element operator [](int index) {
61 return LevelDom.wrapElement(_childElements[index]);
62 }
63
64 void operator []=(int index, Element value) {
65 _element.replaceChild(LevelDom.unwrap(value), _childElements.item(index));
66 }
67
68 void set length(int newLength) {
69 // TODO(jacobr): remove children when length is reduced.
70 throw const UnsupportedOperationException('');
71 }
72
73 Element add(Element value) {
74 _element.appendChild(LevelDom.unwrap(value));
75 return value;
76 }
77
78 Element addLast(Element value) => add(value);
79
80 Iterator<Element> iterator() => _toList().iterator();
81
82 void addAll(Collection<Element> collection) {
83 for (Element element in collection) {
84 _element.appendChild(LevelDom.unwrap(element));
85 }
86 }
87
88 void sort(int compare(Element a, Element b)) {
89 throw const UnsupportedOperationException('TODO(jacobr): should we impl?');
90 }
91
92 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
93 throw 'Not impl yet. todo(jacobr)';
94 }
95
96 void setRange(int start, int length, List from, [int startFrom = 0]) =>
97 Lists.setRange(this, start, length, from, startFrom);
98
99 void removeRange(int start, int length) =>
100 Lists.removeRange(this, start, length, (i) => this[i].remove());
101
102 void insertRange(int start, int length, [initialValue = null]) {
103 throw const NotImplementedException();
104 }
105
106 ElementList getRange(int start, int length) =>
107 new _ElementList(Lists.getRange(this, start, length));
108
109 int indexOf(Element element, [int start = 0]) {
110 return Lists.indexOf(this, element, start, this.length);
111 }
112
113 int lastIndexOf(Element element, [int start = null]) {
114 if (start === null) start = length - 1;
115 return Lists.lastIndexOf(this, element, start);
116 }
117
118 void clear() {
119 // It is unclear if we want to keep non element nodes?
120 _element.textContent = '';
121 }
122
123 Element removeLast() {
124 final last = this.last();
125 if (last != null) {
126 _element.removeChild(LevelDom.unwrap(last));
127 }
128 return last;
129 }
130
131 Element last() {
132 return LevelDom.wrapElement(_element.lastElementChild);
133 }
134 }
135
136 class FrozenElementList implements ElementList {
137 final _ptr;
138
139 FrozenElementList._wrap(this._ptr);
140
141 Element get first() {
142 return this[0];
143 }
144
145 void forEach(void f(Element element)) {
146 for (Element el in this) {
147 f(el);
148 }
149 }
150
151 Collection map(f(Element element)) {
152 final out = [];
153 for (Element el in this) {
154 out.add(f(el));
155 }
156 return out;
157 }
158
159 ElementList filter(bool f(Element element)) {
160 final out = new _ElementList([]);
161 for (Element el in this) {
162 if (f(el)) out.add(el);
163 }
164 return out;
165 }
166
167 bool every(bool f(Element element)) {
168 for(Element element in this) {
169 if (!f(element)) {
170 return false;
171 }
172 };
173 return true;
174 }
175
176 bool some(bool f(Element element)) {
177 for(Element element in this) {
178 if (f(element)) {
179 return true;
180 }
181 };
182 return false;
183 }
184
185 bool isEmpty() {
186 return _ptr.length == 0;
187 }
188
189 int get length() {
190 return _ptr.length;
191 }
192
193 Element operator [](int index) {
194 return LevelDom.wrapElement(_ptr[index]);
195 }
196
197 void operator []=(int index, Element value) {
198 throw const UnsupportedOperationException('');
199 }
200
201 void set length(int newLength) {
202 throw const UnsupportedOperationException('');
203 }
204
205 void add(Element value) {
206 throw const UnsupportedOperationException('');
207 }
208
209
210 void addLast(Element value) {
211 throw const UnsupportedOperationException('');
212 }
213
214 Iterator<Element> iterator() => new FrozenElementListIterator(this);
215
216 void addAll(Collection<Element> collection) {
217 throw const UnsupportedOperationException('');
218 }
219
220 void sort(int compare(Element a, Element b)) {
221 throw const UnsupportedOperationException('');
222 }
223
224 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
225 throw 'Not impl yet. todo(jacobr)';
226 }
227
228 void setRange(int start, int length, List from, [int startFrom = 0]) {
229 throw const UnsupportedOperationException('');
230 }
231
232 void removeRange(int start, int length) {
233 throw const UnsupportedOperationException('');
234 }
235
236 void insertRange(int start, int length, [initialValue = null]) {
237 throw const UnsupportedOperationException('');
238 }
239
240 ElementList getRange(int start, int length) =>
241 new _ElementList(Lists.getRange(this, start, length));
242
243 int indexOf(Element element, [int start = 0]) =>
244 Lists.indexOf(this, element, start, this.length);
245
246 int lastIndexOf(Element element, [int start = null]) {
247 if (start === null) start = length - 1;
248 return Lists.lastIndexOf(this, element, start);
249 }
250
251 void clear() {
252 throw const UnsupportedOperationException('');
253 }
254
255 Element removeLast() {
256 throw const UnsupportedOperationException('');
257 }
258
259 Element last() {
260 return this[length-1];
261 }
262 }
263
264 class FrozenElementListIterator implements Iterator<Element> {
265 final FrozenElementList _list;
266 int _index = 0;
267
268 FrozenElementListIterator(this._list);
269
270 /**
271 * Gets the next element in the iteration. Throws a
272 * [NoMoreElementsException] if no element is left.
273 */
274 Element next() {
275 if (!hasNext()) {
276 throw const NoMoreElementsException();
277 }
278
279 return _list[_index++];
280 }
281
282 /**
283 * Returns whether the [Iterator] has elements left.
284 */
285 bool hasNext() => _index < _list.length;
286 }
287
288 class _ElementList extends _ListWrapper<Element> implements ElementList {
289 _ElementList(List<Element> list) : super(list);
290
291 ElementList filter(bool f(Element element)) =>
292 new _ElementList(super.filter(f));
293
294 ElementList getRange(int start, int length) =>
295 new _ElementList(super.getRange(start, length));
296 }
297
298 class ElementAttributeMap implements Map<String, String> {
299
300 final _element;
301
302 ElementAttributeMap._wrap(this._element);
303
304 bool containsValue(String value) {
305 final attributes = _element.attributes;
306 for (int i = 0, len = attributes.length; i < len; i++) {
307 if(value == attributes.item(i).value) {
308 return true;
309 }
310 }
311 return false;
312 }
313
314 bool containsKey(String key) {
315 return _element.hasAttribute(key);
316 }
317
318 String operator [](String key) {
319 return _element.getAttribute(key);
320 }
321
322 void operator []=(String key, String value) {
323 _element.setAttribute(key, value);
324 }
325
326 String putIfAbsent(String key, String ifAbsent()) {
327 if (!containsKey(key)) {
328 this[key] = ifAbsent();
329 }
330 }
331
332 String remove(String key) {
333 _element.removeAttribute(key);
334 }
335
336 void clear() {
337 final attributes = _element.attributes;
338 for (int i = attributes.length - 1; i >= 0; i--) {
339 _element.removeAttribute(attributes.item(i).name);
340 }
341 }
342
343 void forEach(void f(String key, String value)) {
344 final attributes = _element.attributes;
345 for (int i = 0, len = attributes.length; i < len; i++) {
346 final item = attributes.item(i);
347 f(item.name, item.value);
348 }
349 }
350
351 Collection<String> getKeys() {
352 // TODO(jacobr): generate a lazy collection instead.
353 final attributes = _element.attributes;
354 final keys = new List<String>(attributes.length);
355 for (int i = 0, len = attributes.length; i < len; i++) {
356 keys[i] = attributes.item(i).name;
357 }
358 return keys;
359 }
360
361 Collection<String> getValues() {
362 // TODO(jacobr): generate a lazy collection instead.
363 final attributes = _element.attributes;
364 final values = new List<String>(attributes.length);
365 for (int i = 0, len = attributes.length; i < len; i++) {
366 values[i] = attributes.item(i).value;
367 }
368 return values;
369 }
370
371 /**
372 * The number of {key, value} pairs in the map.
373 */
374 int get length() {
375 return _element.attributes.length;
376 }
377
378 /**
379 * Returns true if there is no {key, value} pair in the map.
380 */
381 bool isEmpty() {
382 return !_element.hasAttributes();
383 }
384 }
385
386 class ElementEventsImplementation extends EventsImplementation implements Elemen tEvents {
387 ElementEventsImplementation._wrap(_ptr) : super._wrap(_ptr);
388
389 EventListenerList get abort() => _get("abort");
390 EventListenerList get beforeCopy() => _get("beforecopy");
391 EventListenerList get beforeCut() => _get("beforecut");
392 EventListenerList get beforePaste() => _get("beforepaste");
393 EventListenerList get blur() => _get("blur");
394 EventListenerList get change() => _get("change");
395 EventListenerList get click() => _get("click");
396 EventListenerList get contextMenu() => _get("contextmenu");
397 EventListenerList get copy() => _get("copy");
398 EventListenerList get cut() => _get("cut");
399 EventListenerList get dblClick() => _get("dblclick");
400 EventListenerList get drag() => _get("drag");
401 EventListenerList get dragEnd() => _get("dragend");
402 EventListenerList get dragEnter() => _get("dragenter");
403 EventListenerList get dragLeave() => _get("dragleave");
404 EventListenerList get dragOver() => _get("dragover");
405 EventListenerList get dragStart() => _get("dragstart");
406 EventListenerList get drop() => _get("drop");
407 EventListenerList get error() => _get("error");
408 EventListenerList get focus() => _get("focus");
409 EventListenerList get input() => _get("input");
410 EventListenerList get invalid() => _get("invalid");
411 EventListenerList get keyDown() => _get("keydown");
412 EventListenerList get keyPress() => _get("keypress");
413 EventListenerList get keyUp() => _get("keyup");
414 EventListenerList get load() => _get("load");
415 EventListenerList get mouseDown() => _get("mousedown");
416 EventListenerList get mouseMove() => _get("mousemove");
417 EventListenerList get mouseOut() => _get("mouseout");
418 EventListenerList get mouseOver() => _get("mouseover");
419 EventListenerList get mouseUp() => _get("mouseup");
420 EventListenerList get mouseWheel() => _get("mousewheel");
421 EventListenerList get paste() => _get("paste");
422 EventListenerList get reset() => _get("reset");
423 EventListenerList get scroll() => _get("scroll");
424 EventListenerList get search() => _get("search");
425 EventListenerList get select() => _get("select");
426 EventListenerList get selectStart() => _get("selectstart");
427 EventListenerList get submit() => _get("submit");
428 EventListenerList get touchCancel() => _get("touchcancel");
429 EventListenerList get touchEnd() => _get("touchend");
430 EventListenerList get touchLeave() => _get("touchleave");
431 EventListenerList get touchMove() => _get("touchmove");
432 EventListenerList get touchStart() => _get("touchstart");
433 EventListenerList get transitionEnd() => _get("webkitTransitionEnd");
434 EventListenerList get fullscreenChange() => _get("webkitfullscreenchange");
435 }
436
437 class SimpleClientRect implements ClientRect {
438 final num left;
439 final num top;
440 final num width;
441 final num height;
442 num get right() => left + width;
443 num get bottom() => top + height;
444
445 const SimpleClientRect(this.left, this.top, this.width, this.height);
446
447 bool operator ==(ClientRect other) {
448 return other !== null && left == other.left && top == other.top
449 && width == other.width && height == other.height;
450 }
451
452 String toString() => "($left, $top, $width, $height)";
453 }
454
455 // TODO(jacobr): we cannot currently be lazy about calculating the client
456 // rects as we must perform all measurement queries at a safe point to avoid
457 // triggering unneeded layouts.
458 /**
459 * All your element measurement needs in one place
460 * @domName none
461 */
462 class ElementRectWrappingImplementation implements ElementRect {
463 final ClientRect client;
464 final ClientRect offset;
465 final ClientRect scroll;
466
467 // TODO(jacobr): should we move these outside of ElementRect to avoid the
468 // overhead of computing them every time even though they are rarely used.
469 // This should be type dom.ClientRect but that fails on dartium. b/5522629
470 final _boundingClientRect;
471 // an exception due to a dartium bug.
472 final _clientRects; // TODO(jacobr): should be dom.ClientRectList
473
474 ElementRectWrappingImplementation(dom.HTMLElement element) :
475 client = new SimpleClientRect(element.clientLeft,
476 element.clientTop,
477 element.clientWidth,
478 element.clientHeight),
479 offset = new SimpleClientRect(element.offsetLeft,
480 element.offsetTop,
481 element.offsetWidth,
482 element.offsetHeight),
483 scroll = new SimpleClientRect(element.scrollLeft,
484 element.scrollTop,
485 element.scrollWidth,
486 element.scrollHeight),
487 _boundingClientRect = element.getBoundingClientRect(),
488 _clientRects = element.getClientRects();
489
490 ClientRect get bounding() =>
491 LevelDom.wrapClientRect(_boundingClientRect);
492
493 List<ClientRect> get clientRects() {
494 final out = new List(_clientRects.length);
495 for (num i = 0; i < _clientRects.length; i++) {
496 out[i] = LevelDom.wrapClientRect(_clientRects.item(i));
497 }
498 return out;
499 }
500 }
501
502 final _START_TAG_REGEXP = const RegExp('<(\\w+)');
503
504 /** @domName Element, HTMLElement */
505 class ElementWrappingImplementation extends NodeWrappingImplementation implement s Element {
506
507 static final _CUSTOM_PARENT_TAG_MAP = const {
508 'body' : 'html',
509 'head' : 'html',
510 'caption' : 'table',
511 'td': 'tr',
512 'colgroup': 'table',
513 'col' : 'colgroup',
514 'tr' : 'tbody',
515 'tbody' : 'table',
516 'tfoot' : 'table',
517 'thead' : 'table',
518 'track' : 'audio',
519 };
520
521 /** @domName Document.createElement */
522 factory ElementWrappingImplementation.html(String html) {
523 // TODO(jacobr): this method can be made more robust and performant.
524 // 1) Cache the dummy parent elements required to use innerHTML rather than
525 // creating them every call.
526 // 2) Verify that the html does not contain leading or trailing text nodes.
527 // 3) Verify that the html does not contain both <head> and <body> tags.
528 // 4) Detatch the created element from its dummy parent.
529 String parentTag = 'div';
530 String tag;
531 final match = _START_TAG_REGEXP.firstMatch(html);
532 if (match !== null) {
533 tag = match.group(1).toLowerCase();
534 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) {
535 parentTag = _CUSTOM_PARENT_TAG_MAP[tag];
536 }
537 }
538 // TODO(jacobr): make type dom.HTMLElement when dartium allows it.
539 var temp = dom.document.createElement(parentTag);
540 temp.innerHTML = html;
541
542 Element element;
543 if (temp.childElementCount == 1) {
544 element = LevelDom.wrapElement(temp.firstElementChild);
545 } else if (parentTag == 'html' && temp.childElementCount == 2) {
546 // Work around for edge case in WebKit and possibly other browsers where
547 // both body and head elements are created even though the inner html
548 // only contains a head or body element.
549 element = LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
550 } else {
551 throw new IllegalArgumentException('HTML had ${temp.childElementCount} ' +
552 'top level elements but 1 expected');
553 }
554 element.remove();
555 return element;
556 }
557
558 /** @domName Document.createElement */
559 factory ElementWrappingImplementation.tag(String tag) {
560 return LevelDom.wrapElement(dom.document.createElement(tag));
561 }
562
563 ElementWrappingImplementation._wrap(ptr) : super._wrap(ptr);
564
565 ElementAttributeMap _elementAttributeMap;
566 ElementList _elements;
567 _CssClassSet _cssClassSet;
568 _DataAttributeMap _dataAttributes;
569
570 /**
571 * @domName Element.hasAttribute, Element.getAttribute, Element.setAttribute,
572 * Element.removeAttribute
573 */
574 Map<String, String> get attributes() {
575 if (_elementAttributeMap === null) {
576 _elementAttributeMap = new ElementAttributeMap._wrap(_ptr);
577 }
578 return _elementAttributeMap;
579 }
580
581 void set attributes(Map<String, String> value) {
582 Map<String, String> attributes = this.attributes;
583 attributes.clear();
584 for (String key in value.getKeys()) {
585 attributes[key] = value[key];
586 }
587 }
588
589 void set elements(Collection<Element> value) {
590 final elements = this.elements;
591 elements.clear();
592 elements.addAll(value);
593 }
594
595 /**
596 * @domName childElementCount, firstElementChild, lastElementChild,
597 * children, Node.appendChild
598 */
599 ElementList get elements() {
600 if (_elements == null) {
601 _elements = new _ChildrenElementList._wrap(_ptr);
602 }
603 return _elements;
604 }
605
606 /** @domName className, classList */
607 Set<String> get classes() {
608 if (_cssClassSet === null) {
609 _cssClassSet = new _CssClassSet(_ptr);
610 }
611 return _cssClassSet;
612 }
613
614 void set classes(Collection<String> value) {
615 _CssClassSet classSet = classes;
616 classSet.clear();
617 classSet.addAll(value);
618 }
619
620 Map<String, String> get dataAttributes() {
621 if (_dataAttributes === null) {
622 _dataAttributes = new _DataAttributeMap(attributes);
623 }
624 return _dataAttributes;
625 }
626
627 void set dataAttributes(Map<String, String> value) {
628 Map<String, String> dataAttributes = this.dataAttributes;
629 dataAttributes.clear();
630 for (String key in value.getKeys()) {
631 dataAttributes[key] = value[key];
632 }
633 }
634
635 String get contentEditable() => _ptr.contentEditable;
636
637 void set contentEditable(String value) { _ptr.contentEditable = value; }
638
639 String get dir() => _ptr.dir;
640
641 void set dir(String value) { _ptr.dir = value; }
642
643 bool get draggable() => _ptr.draggable;
644
645 void set draggable(bool value) { _ptr.draggable = value; }
646
647 Element get firstElementChild() => LevelDom.wrapElement(_ptr.firstElementChild );
648
649 bool get hidden() => _ptr.hidden;
650
651 void set hidden(bool value) { _ptr.hidden = value; }
652
653 String get id() => _ptr.id;
654
655 void set id(String value) { _ptr.id = value; }
656
657 String get innerHTML() => _ptr.innerHTML;
658
659 void set innerHTML(String value) { _ptr.innerHTML = value; }
660
661 bool get isContentEditable() => _ptr.isContentEditable;
662
663 String get lang() => _ptr.lang;
664
665 void set lang(String value) { _ptr.lang = value; }
666
667 Element get lastElementChild() => LevelDom.wrapElement(_ptr.lastElementChild);
668
669 Element get nextElementSibling() => LevelDom.wrapElement(_ptr.nextElementSibli ng);
670
671 Element get offsetParent() => LevelDom.wrapElement(_ptr.offsetParent);
672
673 String get outerHTML() => _ptr.outerHTML;
674
675 Element get previousElementSibling() => LevelDom.wrapElement(_ptr.previousElem entSibling);
676
677 bool get spellcheck() => _ptr.spellcheck;
678
679 void set spellcheck(bool value) { _ptr.spellcheck = value; }
680
681 CSSStyleDeclaration get style() => LevelDom.wrapCSSStyleDeclaration(_ptr.style );
682
683 int get tabIndex() => _ptr.tabIndex;
684
685 void set tabIndex(int value) { _ptr.tabIndex = value; }
686
687 String get tagName() => _ptr.tagName;
688
689 String get title() => _ptr.title;
690
691 void set title(String value) { _ptr.title = value; }
692
693 String get webkitdropzone() => _ptr.webkitdropzone;
694
695 void set webkitdropzone(String value) { _ptr.webkitdropzone = value; }
696
697 void blur() {
698 _ptr.blur();
699 }
700
701 bool contains(Node element) {
702 return _ptr.contains(LevelDom.unwrap(element));
703 }
704
705 void focus() {
706 _ptr.focus();
707 }
708
709 Element insertAdjacentElement([String where = null, Element element = null]) {
710 return LevelDom.wrapElement(_ptr.insertAdjacentElement(where, LevelDom.unwra p(element)));
711 }
712
713 void insertAdjacentHTML([String position_OR_where = null, String text = null]) {
714 _ptr.insertAdjacentHTML(position_OR_where, text);
715 }
716
717 void insertAdjacentText([String where = null, String text = null]) {
718 _ptr.insertAdjacentText(where, text);
719 }
720
721 /** @domName querySelector, Document.getElementById */
722 Element query(String selectors) {
723 // TODO(jacobr): scope fix.
724 return LevelDom.wrapElement(_ptr.querySelector(selectors));
725 }
726
727 /**
728 * @domName querySelectorAll, getElementsByClassName, getElementsByTagName,
729 * getElementsByTagNameNS
730 */
731 ElementList queryAll(String selectors) {
732 // TODO(jacobr): scope fix.
733 return new FrozenElementList._wrap(_ptr.querySelectorAll(selectors));
734 }
735
736 void scrollByLines([int lines = null]) {
737 _ptr.scrollByLines(lines);
738 }
739
740 void scrollByPages([int pages = null]) {
741 _ptr.scrollByPages(pages);
742 }
743
744 /** @domName scrollIntoView, scrollIntoViewIfNeeded */
745 void scrollIntoView([bool centerIfNeeded = null]) {
746 _ptr.scrollIntoViewIfNeeded(centerIfNeeded);
747 }
748
749 bool matchesSelector([String selectors = null]) {
750 return _ptr.webkitMatchesSelector(selectors);
751 }
752
753 void set scrollLeft(int value) { _ptr.scrollLeft = value; }
754
755 void set scrollTop(int value) { _ptr.scrollTop = value; }
756
757 /**
758 * @domName getClientRects, getBoundingClientRect, clientHeight, clientWidth,
759 * clientTop, clientLeft, offsetHeight, offsetWidth, offsetTop, offsetLeft,
760 * scrollHeight, scrollWidth, scrollTop, scrollLeft
761 */
762 Future<ElementRect> get rect() {
763 return _createMeasurementFuture(
764 () => new ElementRectWrappingImplementation(_ptr),
765 new Completer<ElementRect>());
766 }
767
768 /** @domName Window.getComputedStyle */
769 Future<CSSStyleDeclaration> get computedStyle() {
770 // TODO(jacobr): last param should be null, see b/5045788
771 return getComputedStyle('');
772 }
773
774 /** @domName Window.getComputedStyle */
775 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) {
776 return _createMeasurementFuture(() =>
777 LevelDom.wrapCSSStyleDeclaration(
778 dom.window.getComputedStyle(_ptr, pseudoElement)),
779 new Completer<CSSStyleDeclaration>());
780 }
781
782 ElementEvents get on() {
783 if (_on === null) {
784 _on = new ElementEventsImplementation._wrap(_ptr);
785 }
786 return _on;
787 }
788
789 Element clone(bool deep) => super.clone(deep);
790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698