| OLD | NEW |
| 1 library html; | 1 library html; |
| 2 | 2 |
| 3 import 'dart:collection'; | 3 import 'dart:collection'; |
| 4 import 'dart:html_common'; | 4 import 'dart:html_common'; |
| 5 import 'dart:indexed_db'; | 5 import 'dart:indexed_db'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 import 'dart:json'; | 7 import 'dart:json'; |
| 8 import 'dart:svg' as svg; | 8 import 'dart:svg' as svg; |
| 9 import 'dart:web_audio' as web_audio; | 9 import 'dart:web_audio' as web_audio; |
| 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| (...skipping 5514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5525 | 5525 |
| 5526 /// @domName DirectoryReaderSync.readEntries; @docsEditable true | 5526 /// @domName DirectoryReaderSync.readEntries; @docsEditable true |
| 5527 @Returns('_EntryArraySync') @Creates('_EntryArraySync') | 5527 @Returns('_EntryArraySync') @Creates('_EntryArraySync') |
| 5528 List<EntrySync> readEntries() native; | 5528 List<EntrySync> readEntries() native; |
| 5529 } | 5529 } |
| 5530 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 5530 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 5531 // for details. All rights reserved. Use of this source code is governed by a | 5531 // for details. All rights reserved. Use of this source code is governed by a |
| 5532 // BSD-style license that can be found in the LICENSE file. | 5532 // BSD-style license that can be found in the LICENSE file. |
| 5533 | 5533 |
| 5534 | 5534 |
| 5535 /** |
| 5536 * Represents an HTML <div> element. |
| 5537 * |
| 5538 * The [DivElement] is a generic container for content and does not have any |
| 5539 * special significance. It is functionally similar to [SpanElement]. |
| 5540 * |
| 5541 * The [DivElement] is a block-level element, as opposed to [SpanElement], |
| 5542 * which is an inline-level element. |
| 5543 * |
| 5544 * Example usage: |
| 5545 * |
| 5546 * DivElement div = new DivElement(); |
| 5547 * div.text = 'Here's my new DivElem |
| 5548 * document.body.elements.add(elem); |
| 5549 * |
| 5550 * See also: |
| 5551 * |
| 5552 * * [HTML <div> element](http://www.w3.org/TR/html-markup/div.html) from W3C. |
| 5553 * * [Block-level element](http://www.w3.org/TR/CSS2/visuren.html#block-boxes) f
rom W3C. |
| 5554 * * [Inline-level element](http://www.w3.org/TR/CSS2/visuren.html#inline-boxes)
from W3C. |
| 5555 */ |
| 5535 /// @domName HTMLDivElement; @docsEditable true | 5556 /// @domName HTMLDivElement; @docsEditable true |
| 5536 class DivElement extends Element implements Element native "*HTMLDivElement" { | 5557 class DivElement extends Element implements Element native "*HTMLDivElement" { |
| 5537 | 5558 |
| 5538 factory DivElement() => document.$dom_createElement("div"); | 5559 factory DivElement() => document.$dom_createElement("div"); |
| 5539 } | 5560 } |
| 5540 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 5561 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 5541 // for details. All rights reserved. Use of this source code is governed by a | 5562 // for details. All rights reserved. Use of this source code is governed by a |
| 5542 // BSD-style license that can be found in the LICENSE file. | 5563 // BSD-style license that can be found in the LICENSE file. |
| 5543 | 5564 |
| 5544 | 5565 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5563 /// @domName Document.body; @docsEditable true | 5584 /// @domName Document.body; @docsEditable true |
| 5564 @JSName('body') | 5585 @JSName('body') |
| 5565 Element $dom_body; | 5586 Element $dom_body; |
| 5566 | 5587 |
| 5567 /// @domName Document.charset; @docsEditable true | 5588 /// @domName Document.charset; @docsEditable true |
| 5568 String charset; | 5589 String charset; |
| 5569 | 5590 |
| 5570 /// @domName Document.cookie; @docsEditable true | 5591 /// @domName Document.cookie; @docsEditable true |
| 5571 String cookie; | 5592 String cookie; |
| 5572 | 5593 |
| 5594 /// Returns the [Window] associated with the document. |
| 5573 /// @domName Document.defaultView; @docsEditable true | 5595 /// @domName Document.defaultView; @docsEditable true |
| 5574 Window get window => _convertNativeToDart_Window(this._window); | 5596 Window get window => _convertNativeToDart_Window(this._window); |
| 5575 @JSName('defaultView') | 5597 @JSName('defaultView') |
| 5576 @Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object') | 5598 @Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object') |
| 5577 final dynamic _window; | 5599 final dynamic _window; |
| 5578 | 5600 |
| 5579 /// @domName Document.documentElement; @docsEditable true | 5601 /// @domName Document.documentElement; @docsEditable true |
| 5580 final Element documentElement; | 5602 final Element documentElement; |
| 5581 | 5603 |
| 5582 /// @domName Document.domain; @docsEditable true | 5604 /// @domName Document.domain; @docsEditable true |
| (...skipping 6591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12174 final int totalJSHeapSize; | 12196 final int totalJSHeapSize; |
| 12175 | 12197 |
| 12176 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true | 12198 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true |
| 12177 final int usedJSHeapSize; | 12199 final int usedJSHeapSize; |
| 12178 } | 12200 } |
| 12179 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 12201 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 12180 // for details. All rights reserved. Use of this source code is governed by a | 12202 // for details. All rights reserved. Use of this source code is governed by a |
| 12181 // BSD-style license that can be found in the LICENSE file. | 12203 // BSD-style license that can be found in the LICENSE file. |
| 12182 | 12204 |
| 12183 | 12205 |
| 12206 /** |
| 12207 * An HTML <menu> element. |
| 12208 * |
| 12209 * A <menu> element represents an unordered list of menu commands. |
| 12210 * |
| 12211 * See also: |
| 12212 * |
| 12213 * * [Menu Element](https://developer.mozilla.org/en-US/docs/HTML/Element/menu)
from MDN. |
| 12214 * * [Menu Element](http://www.w3.org/TR/html5/the-menu-element.html#the-menu-e
lement) from the W3C. |
| 12215 */ |
| 12184 /// @domName HTMLMenuElement; @docsEditable true | 12216 /// @domName HTMLMenuElement; @docsEditable true |
| 12185 class MenuElement extends Element implements Element native "*HTMLMenuElement" { | 12217 class MenuElement extends Element implements Element native "*HTMLMenuElement" { |
| 12186 | 12218 |
| 12187 factory MenuElement() => document.$dom_createElement("menu"); | 12219 factory MenuElement() => document.$dom_createElement("menu"); |
| 12188 } | 12220 } |
| 12189 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 12221 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 12190 // for details. All rights reserved. Use of this source code is governed by a | 12222 // for details. All rights reserved. Use of this source code is governed by a |
| 12191 // BSD-style license that can be found in the LICENSE file. | 12223 // BSD-style license that can be found in the LICENSE file. |
| 12192 | 12224 |
| 12193 | 12225 |
| (...skipping 9674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21868 * Determines if the current device is running WebKit. | 21900 * Determines if the current device is running WebKit. |
| 21869 */ | 21901 */ |
| 21870 static bool get isWebKit => !isOpera && userAgent.contains("WebKit", 0); | 21902 static bool get isWebKit => !isOpera && userAgent.contains("WebKit", 0); |
| 21871 } | 21903 } |
| 21872 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 21904 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 21873 // for details. All rights reserved. Use of this source code is governed by a | 21905 // for details. All rights reserved. Use of this source code is governed by a |
| 21874 // BSD-style license that can be found in the LICENSE file. | 21906 // BSD-style license that can be found in the LICENSE file. |
| 21875 | 21907 |
| 21876 | 21908 |
| 21877 typedef void EventListener(Event event); | 21909 typedef void EventListener(Event event); |
| 21878 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 21879 // for details. All rights reserved. Use of this source code is governed by a | |
| 21880 // BSD-style license that can be found in the LICENSE file. | |
| 21881 | |
| 21882 | |
| 21883 class FilteredElementList implements List { | |
| 21884 final Node _node; | |
| 21885 final List<Node> _childNodes; | |
| 21886 | |
| 21887 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; | |
| 21888 | |
| 21889 // We can't memoize this, since it's possible that children will be messed | |
| 21890 // with externally to this class. | |
| 21891 // | |
| 21892 // TODO(nweiz): Do we really need to copy the list to make the types work out? | |
| 21893 List<Element> get _filtered => | |
| 21894 new List.from(_childNodes.filter((n) => n is Element)); | |
| 21895 | |
| 21896 void forEach(void f(Element element)) { | |
| 21897 _filtered.forEach(f); | |
| 21898 } | |
| 21899 | |
| 21900 void operator []=(int index, Element value) { | |
| 21901 this[index].replaceWith(value); | |
| 21902 } | |
| 21903 | |
| 21904 void set length(int newLength) { | |
| 21905 final len = this.length; | |
| 21906 if (newLength >= len) { | |
| 21907 return; | |
| 21908 } else if (newLength < 0) { | |
| 21909 throw new ArgumentError("Invalid list length"); | |
| 21910 } | |
| 21911 | |
| 21912 removeRange(newLength - 1, len - newLength); | |
| 21913 } | |
| 21914 | |
| 21915 void add(Element value) { | |
| 21916 _childNodes.add(value); | |
| 21917 } | |
| 21918 | |
| 21919 void addAll(Collection<Element> collection) { | |
| 21920 collection.forEach(add); | |
| 21921 } | |
| 21922 | |
| 21923 void addLast(Element value) { | |
| 21924 add(value); | |
| 21925 } | |
| 21926 | |
| 21927 bool contains(Element element) { | |
| 21928 return element is Element && _childNodes.contains(element); | |
| 21929 } | |
| 21930 | |
| 21931 void sort([int compare(Element a, Element b)]) { | |
| 21932 throw new UnsupportedError('TODO(jacobr): should we impl?'); | |
| 21933 } | |
| 21934 | |
| 21935 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { | |
| 21936 throw new UnimplementedError(); | |
| 21937 } | |
| 21938 | |
| 21939 void removeRange(int start, int rangeLength) { | |
| 21940 _filtered.getRange(start, rangeLength).forEach((el) => el.remove()); | |
| 21941 } | |
| 21942 | |
| 21943 void insertRange(int start, int rangeLength, [initialValue = null]) { | |
| 21944 throw new UnimplementedError(); | |
| 21945 } | |
| 21946 | |
| 21947 void clear() { | |
| 21948 // Currently, ElementList#clear clears even non-element nodes, so we follow | |
| 21949 // that behavior. | |
| 21950 _childNodes.clear(); | |
| 21951 } | |
| 21952 | |
| 21953 Element removeLast() { | |
| 21954 final result = this.last; | |
| 21955 if (result != null) { | |
| 21956 result.remove(); | |
| 21957 } | |
| 21958 return result; | |
| 21959 } | |
| 21960 | |
| 21961 Element removeAt(int index) { | |
| 21962 final result = this[index]; | |
| 21963 result.remove(); | |
| 21964 return result; | |
| 21965 } | |
| 21966 | |
| 21967 dynamic reduce(dynamic initialValue, | |
| 21968 dynamic combine(dynamic previousValue, Element element)) { | |
| 21969 return Collections.reduce(this, initialValue, combine); | |
| 21970 } | |
| 21971 Collection map(f(Element element)) => _filtered.map(f); | |
| 21972 Collection<Element> filter(bool f(Element element)) => _filtered.filter(f); | |
| 21973 bool every(bool f(Element element)) => _filtered.every(f); | |
| 21974 bool some(bool f(Element element)) => _filtered.some(f); | |
| 21975 bool get isEmpty => _filtered.isEmpty; | |
| 21976 int get length => _filtered.length; | |
| 21977 Element operator [](int index) => _filtered[index]; | |
| 21978 Iterator<Element> iterator() => _filtered.iterator(); | |
| 21979 List<Element> getRange(int start, int rangeLength) => | |
| 21980 _filtered.getRange(start, rangeLength); | |
| 21981 int indexOf(Element element, [int start = 0]) => | |
| 21982 _filtered.indexOf(element, start); | |
| 21983 | |
| 21984 int lastIndexOf(Element element, [int start = null]) { | |
| 21985 if (start == null) start = length - 1; | |
| 21986 return _filtered.lastIndexOf(element, start); | |
| 21987 } | |
| 21988 | |
| 21989 Element get first => _filtered.first; | |
| 21990 | |
| 21991 Element get last => _filtered.last; | |
| 21992 } | |
| 21993 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 21910 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 21994 // for details. All rights reserved. Use of this source code is governed by a | 21911 // for details. All rights reserved. Use of this source code is governed by a |
| 21995 // BSD-style license that can be found in the LICENSE file. | 21912 // BSD-style license that can be found in the LICENSE file. |
| 21996 | 21913 |
| 21997 | 21914 |
| 21998 /** | 21915 /** |
| 21999 * Works with KeyboardEvent and KeyEvent to determine how to expose information | 21916 * Works with KeyboardEvent and KeyEvent to determine how to expose information |
| 22000 * about Key(board)Events. This class functions like an EventListenerList, and | 21917 * about Key(board)Events. This class functions like an EventListenerList, and |
| 22001 * provides a consistent interface for the Dart | 21918 * provides a consistent interface for the Dart |
| 22002 * user, despite the fact that a multitude of browsers that have varying | 21919 * user, despite the fact that a multitude of browsers that have varying |
| (...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24500 T next() { | 24417 T next() { |
| 24501 if (!hasNext) { | 24418 if (!hasNext) { |
| 24502 throw new StateError("No more elements"); | 24419 throw new StateError("No more elements"); |
| 24503 } | 24420 } |
| 24504 return _array[_pos++]; | 24421 return _array[_pos++]; |
| 24505 } | 24422 } |
| 24506 | 24423 |
| 24507 final List<T> _array; | 24424 final List<T> _array; |
| 24508 int _pos; | 24425 int _pos; |
| 24509 } | 24426 } |
| OLD | NEW |