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

Unified Diff: lib/html/frog/html_frog.dart

Issue 9732019: dart:html perf optimization based on runing Dromaeo benchmarks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes 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 side-by-side diff with in-line comments
Download patch
Index: lib/html/frog/html_frog.dart
diff --git a/lib/html/frog/html_frog.dart b/lib/html/frog/html_frog.dart
index b88cfdec8137d1472722bda2697c7c5efc232e4c..15aaa6dc44dfb8d3168de09f4a76083b986dde9e 100644
--- a/lib/html/frog/html_frog.dart
+++ b/lib/html/frog/html_frog.dart
@@ -11,45 +11,13 @@
-_WindowImpl _cachedWindow;
-_DocumentImpl _cachedDocument;
-
-void _init() {
- _cachedDocument = _document;
- _cachedWindow = _window;
- // Feature detect that dart:dom and dart:html are not both loaded by
- // checking for the presence of a bug that manifests itself when both
- // libraries are loaded.
- // TODO(jacobr): remove this code once b/1911 is fixed and the frog compiler
- // is changed to generate compile time errors if two libraries that define
- // the same native types in conflicting ways are imported.
- var element = new Element.tag('body');
- element.innerHTML = 'f';
- if (element.text == '') {
- _cachedWindow.console.error(
- 'Cannot import dart:html and dart:dom within the same application.');
- throw new UnsupportedOperationException(
- 'Cannot import dart:html and dart:dom within the same application.');
- }
-}
-
-Window get window() {
- if (_cachedWindow == null) {
- _init();
- }
- return _cachedWindow;
-}
+Window get window() native "return window;";
_WindowImpl get _window() native "return window;";
-Document get document() {
- if (_cachedDocument == null) {
- _init();
- }
- return _cachedDocument;
-}
+Document get document() native "return document;";
-_DocumentImpl get _document() native "return window.document.documentElement;";
+_DocumentImpl get _document() native "return document;";
// Workaround for tags like <cite> that lack their own Element subclass --
// Dart issue 1990.
@@ -61,11 +29,11 @@ class _AbstractWorkerImpl extends _EventTargetImpl implements AbstractWorker nat
_AbstractWorkerEventsImpl get on() =>
new _AbstractWorkerEventsImpl(this);
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
}
class _AbstractWorkerEventsImpl extends _EventsImpl implements AbstractWorkerEvents {
@@ -4207,11 +4175,11 @@ class _DOMApplicationCacheImpl extends _EventTargetImpl implements DOMApplicatio
void abort() native;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
void swapCache() native;
@@ -4322,15 +4290,11 @@ class _DOMImplementationImpl implements DOMImplementation native "*DOMImplementa
_CSSStyleSheetImpl createCSSStyleSheet(String title, String media) native;
- _DocumentImpl createDocument(String namespaceURI, String qualifiedName, _DocumentTypeImpl doctype) => _FixHtmlDocumentReference(_createDocument(namespaceURI, qualifiedName, doctype));
-
- _EventTargetImpl _createDocument(String namespaceURI, String qualifiedName, _DocumentTypeImpl doctype) native "return this.createDocument(namespaceURI, qualifiedName, doctype);";
+ _DocumentImpl createDocument(String namespaceURI, String qualifiedName, _DocumentTypeImpl doctype) native;
_DocumentTypeImpl createDocumentType(String qualifiedName, String publicId, String systemId) native;
- _DocumentImpl createHTMLDocument(String title) => _FixHtmlDocumentReference(_createHTMLDocument(title));
-
- _EventTargetImpl _createHTMLDocument(String title) native "return this.createHTMLDocument(title);";
+ _DocumentImpl createHTMLDocument(String title) native;
bool hasFeature(String feature, String version) native;
}
@@ -4357,9 +4321,7 @@ class _DOMMimeTypeArrayImpl implements DOMMimeTypeArray native "*DOMMimeTypeArra
class _DOMParserImpl implements DOMParser native "*DOMParser" {
- _DocumentImpl parseFromString(String str, String contentType) => _FixHtmlDocumentReference(_parseFromString(str, contentType));
-
- _EventTargetImpl _parseFromString(String str, String contentType) native "return this.parseFromString(str, contentType);";
+ _DocumentImpl parseFromString(String str, String contentType) native;
}
class _DOMPluginImpl implements DOMPlugin native "*DOMPlugin" {
@@ -4680,131 +4642,148 @@ class _DivElementImpl extends _ElementImpl implements DivElement native "*HTMLDi
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class _DocumentImpl extends _ElementImpl
+class _DocumentImpl extends _NodeImpl
implements Document
- native "*HTMLHtmlElement" {
+ native "*HTMLDocument"
+ {
+
_DocumentEventsImpl get on() =>
- new _DocumentEventsImpl(_jsDocument);
+ new _DocumentEventsImpl(this);
- _ElementImpl get activeElement() native "return this.parentNode.activeElement;";
+ final _ElementImpl activeElement;
- _ElementImpl get body() native "return this.parentNode.body;";
+ _ElementImpl body;
- void set body(_ElementImpl value) native "this.parentNode.body = value;";
+ String charset;
+
+ String cookie;
- String get charset() native "return this.parentNode.charset;";
+ _WindowImpl get window() native "return this.defaultView;";
- void set charset(String value) native "this.parentNode.charset = value;";
+ final _ElementImpl documentElement;
- String get cookie() native "return this.parentNode.cookie;";
+ final String domain;
- void set cookie(String value) native "this.parentNode.cookie = value;";
+ final _HeadElementImpl head;
- _WindowImpl get window() native "return this.parentNode.defaultView;";
+ final String lastModified;
- String get domain() native "return this.parentNode.domain;";
+ final String preferredStylesheetSet;
- _HeadElementImpl get head() native "return this.parentNode.head;";
+ final String readyState;
- String get lastModified() native "return this.parentNode.lastModified;";
+ final String referrer;
- String get preferredStylesheetSet() native "return this.parentNode.preferredStylesheetSet;";
+ String selectedStylesheetSet;
- String get readyState() native "return this.parentNode.readyState;";
+ final _StyleSheetListImpl styleSheets;
- String get referrer() native "return this.parentNode.referrer;";
+ String title;
- String get selectedStylesheetSet() native "return this.parentNode.selectedStylesheetSet;";
+ final _ElementImpl webkitCurrentFullScreenElement;
- void set selectedStylesheetSet(String value) native "this.parentNode.selectedStylesheetSet = value;";
+ final bool webkitFullScreenKeyboardInputAllowed;
- _StyleSheetListImpl get styleSheets() native "return this.parentNode.styleSheets;";
+ final _ElementImpl webkitFullscreenElement;
- String get title() native "return this.parentNode.title;";
+ final bool webkitFullscreenEnabled;
- void set title(String value) native "this.parentNode.title = value;";
+ final bool webkitHidden;
- _ElementImpl get webkitCurrentFullScreenElement() native "return this.parentNode.webkitCurrentFullScreenElement;";
+ final bool webkitIsFullScreen;
- bool get webkitFullScreenKeyboardInputAllowed() native "return this.parentNode.webkitFullScreenKeyboardInputAllowed;";
+ final String webkitVisibilityState;
- _ElementImpl get webkitFullscreenElement() native "return this.parentNode.webkitFullscreenElement;";
+ _RangeImpl caretRangeFromPoint(int x, int y) native;
- bool get webkitFullscreenEnabled() native "return this.parentNode.webkitFullscreenEnabled;";
+ _CDATASectionImpl createCDATASection(String data) native;
- bool get webkitHidden() native "return this.parentNode.webkitHidden;";
+ _DocumentFragmentImpl createDocumentFragment() native;
- bool get webkitIsFullScreen() native "return this.parentNode.webkitIsFullScreen;";
+ _ElementImpl $dom_createElement(String tagName) native "return this.createElement(tagName);";
- String get webkitVisibilityState() native "return this.parentNode.webkitVisibilityState;";
+ _ElementImpl $dom_createElementNS(String namespaceURI, String qualifiedName) native "return this.createElementNS(namespaceURI, qualifiedName);";
- _RangeImpl caretRangeFromPoint(int x, int y) native "return this.parentNode.caretRangeFromPoint(x, y);";
+ _EventImpl $dom_createEvent(String eventType) native "return this.createEvent(eventType);";
- _CDATASectionImpl createCDATASection(String data) native "return this.parentNode.createCDATASection(data);";
+ _RangeImpl createRange() native;
- _DocumentFragmentImpl createDocumentFragment() native "return this.parentNode.createDocumentFragment();";
+ _TextImpl $dom_createTextNode(String data) native "return this.createTextNode(data);";
- _ElementImpl _createElement(String tagName) native "return this.parentNode.createElement(tagName);";
+ _TouchImpl createTouch(_WindowImpl window, _EventTargetImpl target, int identifier, int pageX, int pageY, int screenX, int screenY, int webkitRadiusX, int webkitRadiusY, num webkitRotationAngle, num webkitForce) native;
- _ElementImpl _createElementNS(String namespaceURI, String qualifiedName) native "return this.parentNode.createElementNS(namespaceURI, qualifiedName);";
+ _TouchListImpl $dom_createTouchList() native "return this.createTouchList();";
- _EventImpl _createEvent(String eventType) native "return this.parentNode.createEvent(eventType);";
+ _ElementImpl elementFromPoint(int x, int y) native;
- _RangeImpl createRange() native "return this.parentNode.createRange();";
+ bool execCommand(String command, bool userInterface, String value) native;
- _TextImpl _createTextNode(String data) native "return this.parentNode.createTextNode(data);";
+ _CanvasRenderingContextImpl getCSSCanvasContext(String contextId, String name, int width, int height) native;
- _TouchImpl createTouch(_WindowImpl window, _EventTargetImpl target, int identifier, int pageX, int pageY, int screenX, int screenY, int webkitRadiusX, int webkitRadiusY, num webkitRotationAngle, num webkitForce) native "return this.parentNode.createTouch(window, target, identifier, pageX, pageY, screenX, screenY, webkitRadiusX, webkitRadiusY, webkitRotationAngle, webkitForce);";
+ _ElementImpl $dom_getElementById(String elementId) native "return this.getElementById(elementId);";
- _TouchListImpl _createTouchList() native "return this.parentNode.createTouchList();";
+ _NodeListImpl $dom_getElementsByClassName(String tagname) native "return this.getElementsByClassName(tagname);";
- _ElementImpl elementFromPoint(int x, int y) native "return this.parentNode.elementFromPoint(x, y);";
+ _NodeListImpl $dom_getElementsByName(String elementName) native "return this.getElementsByName(elementName);";
- bool execCommand(String command, bool userInterface, String value) native "return this.parentNode.execCommand(command, userInterface, value);";
+ _NodeListImpl $dom_getElementsByTagName(String tagname) native "return this.getElementsByTagName(tagname);";
- _CanvasRenderingContextImpl getCSSCanvasContext(String contextId, String name, int width, int height) native "return this.parentNode.getCSSCanvasContext(contextId, name, width, height);";
+ bool queryCommandEnabled(String command) native;
- bool queryCommandEnabled(String command) native "return this.parentNode.queryCommandEnabled(command);";
+ bool queryCommandIndeterm(String command) native;
- bool queryCommandIndeterm(String command) native "return this.parentNode.queryCommandIndeterm(command);";
+ bool queryCommandState(String command) native;
- bool queryCommandState(String command) native "return this.parentNode.queryCommandState(command);";
+ bool queryCommandSupported(String command) native;
- bool queryCommandSupported(String command) native "return this.parentNode.queryCommandSupported(command);";
+ String queryCommandValue(String command) native;
- String queryCommandValue(String command) native "return this.parentNode.queryCommandValue(command);";
+ _ElementImpl _query(String selectors) native "return this.querySelector(selectors);";
- void webkitCancelFullScreen() native "this.parentNode.webkitCancelFullScreen();";
+ _NodeListImpl $dom_querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
- void webkitExitFullscreen() native "this.parentNode.webkitExitFullscreen();";
+ void webkitCancelFullScreen() native;
- _WebKitNamedFlowImpl webkitGetFlowByName(String name) native "return this.parentNode.webkitGetFlowByName(name);";
+ void webkitExitFullscreen() native;
+ _WebKitNamedFlowImpl webkitGetFlowByName(String name) native;
- // For efficiency and simplicity, we always use the HtmlElement as the
- // Document but sometimes internally we need the real JS document object.
- _NodeImpl get _jsDocument() native "return this.parentNode;";
+ // TODO(jacobr): implement all Element methods not on Document.
- // The document doesn't have a parent element.
- _ElementImpl get parent() => null;
-}
+ _ElementImpl query(String selectors) {
+ // It is fine for our RegExp to detect element id query selectors to have
+ // false negatives but not false positives.
+ if (const RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
+ return $dom_getElementById(selectors.substring(1));
+ }
+ return $dom_querySelector(selectors);
+ }
-// This class should not be externally visible. If a user ever gets access to
-// a _SecretHtmlDocumentImpl object that is a bug. This object is hidden by
-// adding checks to all methods that could an HTMLDocument. We believe that
-// list is limited to Event.target, and HTMLHtmlElement.parent.
-class _SecretHtmlDocumentImpl extends _NodeImpl implements Node
- native "*HTMLDocument" {
- _DocumentImpl get _documentElement() native "return this.documentElement;";
-}
+// TODO(jacobr): autogenerate this method.
+ _ElementImpl $dom_querySelector(String selectors) native "return this.querySelector(selectors);";
-EventTarget _FixHtmlDocumentReference(EventTarget eventTarget) {
- if (eventTarget is _SecretHtmlDocumentImpl) {
- _SecretHtmlDocumentImpl secretDocument = eventTarget;
- return secretDocument._documentElement;
- } else {
- return eventTarget;
+ ElementList queryAll(String selectors) {
+ if (const RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
+ final mutableMatches = $dom_getElementsByName(
+ selectors.substring(7,selectors.length - 2));
+ int len = mutableMatches.length;
+ final copyOfMatches = new List<Element>(len);
+ for (int i = 0; i < len; ++i) {
+ copyOfMatches[i] = mutableMatches[i];
+ }
+ return new _FrozenElementList._wrap(copyOfMatches);
+ } else if (const RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
+ final mutableMatches = $dom_getElementsByTagName(selectors);
+ int len = mutableMatches.length;
+ final copyOfMatches = new List<Element>(len);
+ for (int i = 0; i < len; ++i) {
+ copyOfMatches[i] = mutableMatches[i];
+ }
+ return new _FrozenElementList._wrap(copyOfMatches);
+ } else {
+ return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
+ }
}
}
@@ -5053,7 +5032,7 @@ class _DocumentFragmentImpl extends _NodeImpl implements DocumentFragment native
}
ElementList queryAll(String selectors) =>
- new _FrozenElementList._wrap(_querySelectorAll(selectors));
+ new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
String get innerHTML() {
final e = new Element.tag("div");
@@ -5122,8 +5101,8 @@ class _DocumentFragmentImpl extends _NodeImpl implements DocumentFragment native
String get tagName() => "";
String get webkitdropzone() => "";
String get webkitRegionOverflow() => "";
- Element get firstElementChild() => elements.first();
- Element get lastElementChild() => elements.last();
+ Element get $dom_firstElementChild() => elements.first();
+ Element get $dom_lastElementChild() => elements.last();
Element get nextElementSibling() => null;
Element get previousElementSibling() => null;
Element get offsetParent() => null;
@@ -5253,7 +5232,7 @@ class _DocumentFragmentImpl extends _NodeImpl implements DocumentFragment native
_ElementImpl query(String selectors) native "return this.querySelector(selectors);";
- _NodeListImpl _querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
+ _NodeListImpl $dom_querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
}
@@ -5301,7 +5280,7 @@ class _ChildrenElementList implements ElementList {
final _HTMLCollectionImpl _childElements;
_ChildrenElementList._wrap(_ElementImpl element)
- : _childElements = element._children,
+ : _childElements = element.$dom_children,
_element = element;
List<Element> _toList() {
@@ -5313,7 +5292,7 @@ class _ChildrenElementList implements ElementList {
}
_ElementImpl get first() {
- return _element._firstElementChild;
+ return _element.$dom_firstElementChild;
}
void forEach(void f(Element element)) {
@@ -5359,7 +5338,7 @@ class _ChildrenElementList implements ElementList {
}
bool isEmpty() {
- return _element._firstElementChild == null;
+ return _element.$dom_firstElementChild == null;
}
int get length() {
@@ -5371,7 +5350,7 @@ class _ChildrenElementList implements ElementList {
}
void operator []=(int index, _ElementImpl value) {
- _element._replaceChild(value, _childElements[index]);
+ _element.$dom_replaceChild(value, _childElements[index]);
}
void set length(int newLength) {
@@ -5380,7 +5359,7 @@ class _ChildrenElementList implements ElementList {
}
Element add(_ElementImpl value) {
- _element._appendChild(value);
+ _element.$dom_appendChild(value);
return value;
}
@@ -5390,7 +5369,7 @@ class _ChildrenElementList implements ElementList {
void addAll(Collection<Element> collection) {
for (_ElementImpl element in collection) {
- _element._appendChild(element);
+ _element.$dom_appendChild(element);
}
}
@@ -5435,13 +5414,13 @@ class _ChildrenElementList implements ElementList {
Element removeLast() {
final last = this.last();
if (last != null) {
- _element._removeChild(last);
+ _element.$dom_removeChild(last);
}
return last;
}
Element last() {
- return _element.lastElementChild;
+ return _element.$dom_lastElementChild;
}
}
@@ -5603,7 +5582,7 @@ class ElementAttributeMap implements Map<String, String> {
ElementAttributeMap._wrap(this._element);
bool containsValue(String value) {
- final attributes = _element._attributes;
+ final attributes = _element.$dom_attributes;
for (int i = 0, len = attributes.length; i < len; i++) {
if(value == attributes[i].value) {
return true;
@@ -5613,15 +5592,15 @@ class ElementAttributeMap implements Map<String, String> {
}
bool containsKey(String key) {
- return _element._hasAttribute(key);
+ return _element.$dom_hasAttribute(key);
}
String operator [](String key) {
- return _element._getAttribute(key);
+ return _element.$dom_getAttribute(key);
}
void operator []=(String key, String value) {
- _element._setAttribute(key, value);
+ _element.$dom_setAttribute(key, value);
}
String putIfAbsent(String key, String ifAbsent()) {
@@ -5631,18 +5610,18 @@ class ElementAttributeMap implements Map<String, String> {
}
String remove(String key) {
- _element._removeAttribute(key);
+ _element.$dom_removeAttribute(key);
}
void clear() {
- final attributes = _element._attributes;
+ final attributes = _element.$dom_attributes;
for (int i = attributes.length - 1; i >= 0; i--) {
remove(attributes[i].name);
}
}
void forEach(void f(String key, String value)) {
- final attributes = _element._attributes;
+ final attributes = _element.$dom_attributes;
for (int i = 0, len = attributes.length; i < len; i++) {
final item = attributes[i];
f(item.name, item.value);
@@ -5651,7 +5630,7 @@ class ElementAttributeMap implements Map<String, String> {
Collection<String> getKeys() {
// TODO(jacobr): generate a lazy collection instead.
- final attributes = _element._attributes;
+ final attributes = _element.$dom_attributes;
final keys = new List<String>(attributes.length);
for (int i = 0, len = attributes.length; i < len; i++) {
keys[i] = attributes[i].name;
@@ -5661,7 +5640,7 @@ class ElementAttributeMap implements Map<String, String> {
Collection<String> getValues() {
// TODO(jacobr): generate a lazy collection instead.
- final attributes = _element._attributes;
+ final attributes = _element.$dom_attributes;
final values = new List<String>(attributes.length);
for (int i = 0, len = attributes.length; i < len; i++) {
values[i] = attributes[i].value;
@@ -5673,7 +5652,7 @@ class ElementAttributeMap implements Map<String, String> {
* The number of {key, value} pairs in the map.
*/
int get length() {
- return _element._attributes.length;
+ return _element.$dom_attributes.length;
}
/**
@@ -5720,20 +5699,20 @@ class _ElementRectImpl implements ElementRect {
final _ClientRectListImpl _clientRects;
_ElementRectImpl(_ElementImpl element) :
- client = new _SimpleClientRect(element._clientLeft,
- element._clientTop,
- element._clientWidth,
- element._clientHeight),
- offset = new _SimpleClientRect(element._offsetLeft,
- element._offsetTop,
- element._offsetWidth,
- element._offsetHeight),
- scroll = new _SimpleClientRect(element._scrollLeft,
- element._scrollTop,
- element._scrollWidth,
- element._scrollHeight),
- _boundingClientRect = element._getBoundingClientRect(),
- _clientRects = element._getClientRects();
+ client = new _SimpleClientRect(element.$dom_clientLeft,
+ element.$dom_clientTop,
+ element.$dom_clientWidth,
+ element.$dom_clientHeight),
+ offset = new _SimpleClientRect(element.$dom_offsetLeft,
+ element.$dom_offsetTop,
+ element.$dom_offsetWidth,
+ element.$dom_offsetHeight),
+ scroll = new _SimpleClientRect(element.$dom_scrollLeft,
+ element.$dom_scrollTop,
+ element.$dom_scrollWidth,
+ element.$dom_scrollHeight),
+ _boundingClientRect = element.$dom_getBoundingClientRect(),
+ _clientRects = element.$dom_getClientRects();
_ClientRectImpl get bounding() => _boundingClientRect;
@@ -5782,7 +5761,7 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
ElementList get elements() => new _ChildrenElementList._wrap(this);
ElementList queryAll(String selectors) =>
- new _FrozenElementList._wrap(_querySelectorAll(selectors));
+ new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
Set<String> get classes() {
if (_cssClassSet === null) {
@@ -5825,7 +5804,7 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) {
return _createMeasurementFuture(
- () => _window._getComputedStyle(this, pseudoElement),
+ () => _window.$dom_getComputedStyle(this, pseudoElement),
new Completer<CSSStyleDeclaration>());
}
@@ -5834,21 +5813,21 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
static final int ALLOW_KEYBOARD_INPUT = 1;
- int get _childElementCount() native "return this.childElementCount;";
+ int get $dom_childElementCount() native "return this.childElementCount;";
- _HTMLCollectionImpl get _children() native "return this.children;";
+ _HTMLCollectionImpl get $dom_children() native "return this.children;";
- String get _className() native "return this.className;";
+ String get $dom_className() native "return this.className;";
- void set _className(String value) native "this.className = value;";
+ void set $dom_className(String value) native "this.className = value;";
- int get _clientHeight() native "return this.clientHeight;";
+ int get $dom_clientHeight() native "return this.clientHeight;";
- int get _clientLeft() native "return this.clientLeft;";
+ int get $dom_clientLeft() native "return this.clientLeft;";
- int get _clientTop() native "return this.clientTop;";
+ int get $dom_clientTop() native "return this.clientTop;";
- int get _clientWidth() native "return this.clientWidth;";
+ int get $dom_clientWidth() native "return this.clientWidth;";
String contentEditable;
@@ -5856,7 +5835,7 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
bool draggable;
- _ElementImpl get _firstElementChild() native "return this.firstElementChild;";
+ _ElementImpl get $dom_firstElementChild() native "return this.firstElementChild;";
bool hidden;
@@ -5868,35 +5847,35 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
String lang;
- final _ElementImpl lastElementChild;
+ _ElementImpl get $dom_lastElementChild() native "return this.lastElementChild;";
final _ElementImpl nextElementSibling;
- int get _offsetHeight() native "return this.offsetHeight;";
+ int get $dom_offsetHeight() native "return this.offsetHeight;";
- int get _offsetLeft() native "return this.offsetLeft;";
+ int get $dom_offsetLeft() native "return this.offsetLeft;";
final _ElementImpl offsetParent;
- int get _offsetTop() native "return this.offsetTop;";
+ int get $dom_offsetTop() native "return this.offsetTop;";
- int get _offsetWidth() native "return this.offsetWidth;";
+ int get $dom_offsetWidth() native "return this.offsetWidth;";
final String outerHTML;
final _ElementImpl previousElementSibling;
- int get _scrollHeight() native "return this.scrollHeight;";
+ int get $dom_scrollHeight() native "return this.scrollHeight;";
- int get _scrollLeft() native "return this.scrollLeft;";
+ int get $dom_scrollLeft() native "return this.scrollLeft;";
- void set _scrollLeft(int value) native "this.scrollLeft = value;";
+ void set $dom_scrollLeft(int value) native "this.scrollLeft = value;";
- int get _scrollTop() native "return this.scrollTop;";
+ int get $dom_scrollTop() native "return this.scrollTop;";
- void set _scrollTop(int value) native "this.scrollTop = value;";
+ void set $dom_scrollTop(int value) native "this.scrollTop = value;";
- int get _scrollWidth() native "return this.scrollWidth;";
+ int get $dom_scrollWidth() native "return this.scrollWidth;";
bool spellcheck;
@@ -5920,13 +5899,17 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
void focus() native;
- String _getAttribute(String name) native "return this.getAttribute(name);";
+ String $dom_getAttribute(String name) native "return this.getAttribute(name);";
+
+ _ClientRectImpl $dom_getBoundingClientRect() native "return this.getBoundingClientRect();";
+
+ _ClientRectListImpl $dom_getClientRects() native "return this.getClientRects();";
- _ClientRectImpl _getBoundingClientRect() native "return this.getBoundingClientRect();";
+ _NodeListImpl $dom_getElementsByClassName(String name) native "return this.getElementsByClassName(name);";
- _ClientRectListImpl _getClientRects() native "return this.getClientRects();";
+ _NodeListImpl $dom_getElementsByTagName(String name) native "return this.getElementsByTagName(name);";
- bool _hasAttribute(String name) native "return this.hasAttribute(name);";
+ bool $dom_hasAttribute(String name) native "return this.hasAttribute(name);";
_ElementImpl insertAdjacentElement(String where, _ElementImpl element) native;
@@ -5936,9 +5919,9 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
_ElementImpl query(String selectors) native "return this.querySelector(selectors);";
- _NodeListImpl _querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
+ _NodeListImpl $dom_querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
- void _removeAttribute(String name) native "this.removeAttribute(name);";
+ void $dom_removeAttribute(String name) native "this.removeAttribute(name);";
void scrollByLines(int lines) native;
@@ -5946,7 +5929,7 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
void scrollIntoView([bool centerIfNeeded = null]) native "this.scrollIntoViewIfNeeded(centerIfNeeded);";
- void _setAttribute(String name, String value) native "this.setAttribute(name, value);";
+ void $dom_setAttribute(String name, String value) native "this.setAttribute(name, value);";
bool matchesSelector(String selectors) native "return this.webkitMatchesSelector(selectors);";
@@ -5956,6 +5939,64 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
}
+final _START_TAG_REGEXP = const RegExp('<(\\w+)');
+class _ElementFactoryProvider {
+ static final _CUSTOM_PARENT_TAG_MAP = const {
+ 'body' : 'html',
+ 'head' : 'html',
+ 'caption' : 'table',
+ 'td': 'tr',
+ 'colgroup': 'table',
+ 'col' : 'colgroup',
+ 'tr' : 'tbody',
+ 'tbody' : 'table',
+ 'tfoot' : 'table',
+ 'thead' : 'table',
+ 'track' : 'audio',
+ };
+
+ /** @domName Document.createElement */
+ factory Element.html(String html) {
+ // TODO(jacobr): this method can be made more robust and performant.
+ // 1) Cache the dummy parent elements required to use innerHTML rather than
+ // creating them every call.
+ // 2) Verify that the html does not contain leading or trailing text nodes.
+ // 3) Verify that the html does not contain both <head> and <body> tags.
+ // 4) Detatch the created element from its dummy parent.
+ String parentTag = 'div';
+ String tag;
+ final match = _START_TAG_REGEXP.firstMatch(html);
+ if (match !== null) {
+ tag = match.group(1).toLowerCase();
+ if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) {
+ parentTag = _CUSTOM_PARENT_TAG_MAP[tag];
+ }
+ }
+ final _ElementImpl temp = new Element.tag(parentTag);
+ temp.innerHTML = html;
+
+ Element element;
+ if (temp.elements.length == 1) {
+ element = temp.elements.first;
+ } else if (parentTag == 'html' && temp.elements.length == 2) {
+ // Work around for edge case in WebKit and possibly other browsers where
+ // both body and head elements are created even though the inner html
+ // only contains a head or body element.
+ element = temp.elements[tag == 'head' ? 0 : 1];
+ } else {
+ throw new IllegalArgumentException('HTML had ${temp.elements.length} ' +
+ 'top level elements but 1 expected');
+ }
+ element.remove();
+ return element;
+ }
+
+ /** @domName Document.createElement */
+ // Optimization to improve performance until the frog compiler inlines this
+ // method.
+ factory Element.tag(String tag) native "return document.createElement(tag)";
+}
+
class _ElementEventsImpl extends _EventsImpl implements ElementEvents {
_ElementEventsImpl(_ptr) : super(_ptr);
@@ -6226,9 +6267,7 @@ class _EventImpl implements Event native "*Event" {
final _ClipboardImpl clipboardData;
- _EventTargetImpl get currentTarget() => _FixHtmlDocumentReference(_currentTarget);
-
- _EventTargetImpl get _currentTarget() native "return this.currentTarget;";
+ final _EventTargetImpl currentTarget;
final bool defaultPrevented;
@@ -6236,19 +6275,15 @@ class _EventImpl implements Event native "*Event" {
bool returnValue;
- _EventTargetImpl get srcElement() => _FixHtmlDocumentReference(_srcElement);
-
- _EventTargetImpl get _srcElement() native "return this.srcElement;";
+ final _EventTargetImpl srcElement;
- _EventTargetImpl get target() => _FixHtmlDocumentReference(_target);
-
- _EventTargetImpl get _target() native "return this.target;";
+ final _EventTargetImpl target;
final int timeStamp;
final String type;
- void _initEvent(String eventTypeArg, bool canBubbleArg, bool cancelableArg) native "this.initEvent(eventTypeArg, canBubbleArg, cancelableArg);";
+ void $dom_initEvent(String eventTypeArg, bool canBubbleArg, bool cancelableArg) native "this.initEvent(eventTypeArg, canBubbleArg, cancelableArg);";
void preventDefault() native;
@@ -6289,13 +6324,13 @@ class _EventSourceImpl extends _EventTargetImpl implements EventSource native "*
final String url;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
void close() native;
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
}
class _EventSourceEventsImpl extends _EventsImpl implements EventSourceEvents {
@@ -6352,15 +6387,15 @@ class _EventListenerListImpl implements EventListenerList {
// TODO(jacobr): what is the correct behavior here. We could alternately
// force the event to have the expected type.
assert(evt.type == _type);
- return _ptr._dispatchEvent(evt);
+ return _ptr.$dom_dispatchEvent(evt);
}
void _add(EventListener listener, bool useCapture) {
- _ptr._addEventListener(_type, listener, useCapture);
+ _ptr.$dom_addEventListener(_type, listener, useCapture);
}
void _remove(EventListener listener, bool useCapture) {
- _ptr._removeEventListener(_type, listener, useCapture);
+ _ptr.$dom_removeEventListener(_type, listener, useCapture);
}
}
@@ -6369,11 +6404,11 @@ class _EventTargetImpl implements EventTarget native "*EventTarget" {
Events get on() => new _EventsImpl(this);
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl event) native "return this.dispatchEvent(event);";
+ bool $dom_dispatchEvent(_EventImpl event) native "return this.dispatchEvent(event);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
}
@@ -6814,9 +6849,7 @@ class _FormElementImpl extends _ElementImpl implements FormElement native "*HTML
class _FrameElementImpl extends _ElementImpl implements FrameElement native "*HTMLFrameElement" {
- _DocumentImpl get contentDocument() => _FixHtmlDocumentReference(_contentDocument);
-
- _EventTargetImpl get _contentDocument() native "return this.contentDocument;";
+ final _DocumentImpl contentDocument;
final _WindowImpl contentWindow;
@@ -7059,13 +7092,8 @@ class _HistoryImpl implements History native "*History" {
void replaceState(Object data, String title, [String url = null]) native;
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class _HtmlElementImpl extends _ElementImpl implements HtmlElement
- native "*IntentionallyInvalid" {
+class _HtmlElementImpl extends _ElementImpl implements HtmlElement native "*HTMLHtmlElement" {
}
class _IDBAnyImpl implements IDBAny native "*IDBAny" {
@@ -7335,9 +7363,7 @@ class _IFrameElementImpl extends _ElementImpl implements IFrameElement native "*
String align;
- _DocumentImpl get contentDocument() => _FixHtmlDocumentReference(_contentDocument);
-
- _EventTargetImpl get _contentDocument() native "return this.contentDocument;";
+ final _DocumentImpl contentDocument;
final _WindowImpl contentWindow;
@@ -8380,15 +8406,15 @@ class _MessagePortImpl extends _EventTargetImpl implements MessagePort native "*
_MessagePortEventsImpl get on() =>
new _MessagePortEventsImpl(this);
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
void close() native;
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
void postMessage(String message, [List messagePorts = null]) native;
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
void start() native;
@@ -8465,9 +8491,7 @@ class _MouseEventImpl extends _UIEventImpl implements MouseEvent native "*MouseE
final int offsetY;
- _EventTargetImpl get relatedTarget() => _FixHtmlDocumentReference(_relatedTarget);
-
- _EventTargetImpl get _relatedTarget() native "return this.relatedTarget;";
+ final _EventTargetImpl relatedTarget;
final int screenX;
@@ -8481,7 +8505,7 @@ class _MouseEventImpl extends _UIEventImpl implements MouseEvent native "*MouseE
final int y;
- void _initMouseEvent(String type, bool canBubble, bool cancelable, _WindowImpl view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, int button, _EventTargetImpl relatedTarget) native "this.initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);";
+ void $dom_initMouseEvent(String type, bool canBubble, bool cancelable, _WindowImpl view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, int button, _EventTargetImpl relatedTarget) native "this.initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);";
}
class _MutationEventImpl extends _EventImpl implements MutationEvent native "*MutationEvent" {
@@ -8648,11 +8672,110 @@ class _NavigatorUserMediaErrorImpl implements NavigatorUserMediaError native "*N
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+/**
+ * Lazy implementation of the child nodes of an element that does not request
+ * the actual child nodes of an element until strictly necessary greatly
+ * improving performance for the typical cases where it is not required.
+ */
+class _ChildNodeListLazy implements NodeList {
+ final _NodeImpl _this;
+
+ _ChildNodeListLazy(this._this);
+
+
+ _NodeImpl get first() native "return this._this.firstChild;";
+ _NodeImpl last() native "return this._this.lastChild;";
+
+ void add(_NodeImpl value) {
+ _this.$dom_appendChild(value);
+ }
+
+ void addLast(_NodeImpl value) {
+ _this.$dom_appendChild(value);
+ }
+
+
+ void addAll(Collection<_NodeImpl> collection) {
+ for (_NodeImpl node in collection) {
+ _this.$dom_appendChild(node);
+ }
+ }
+
+ _NodeImpl removeLast() {
+ final last = last();
+ if (last != null) {
+ _this.$dom_removeChild(last);
+ }
+ return last;
+ }
+
+ void clear() {
+ _this.text = '';
+ }
+
+ void operator []=(int index, _NodeImpl value) {
+ _this.$dom_replaceChild(value, this[index]);
+ }
+
+ Iterator<Node> iterator() => _this.$dom_childNodes.iterator();
+
+ // TODO(jacobr): We can implement these methods much more efficiently by
+ // looking up the nodeList only once instead of once per iteration.
+ void forEach(void f(Node element)) => _Collections.forEach(this, f);
+
+ Collection map(f(Node element)) => _Collections.map(this, [], f);
+
+ Collection<Node> filter(bool f(Node element)) =>
+ new _NodeListWrapper(_Collections.filter(this, <Node>[], f));
+
+ bool every(bool f(Node element)) => _Collections.every(this, f);
+
+ bool some(bool f(Node element)) => _Collections.some(this, f);
+
+ bool isEmpty() => this.length == 0;
+
+ // From List<Node>:
+
+ // TODO(jacobr): this could be implemented for child node lists.
+ // The exception we throw here is misleading.
+ void sort(int compare(Node a, Node b)) {
+ throw new UnsupportedOperationException("Cannot sort immutable List.");
+ }
+
+ int indexOf(Node element, [int start = 0]) =>
+ _Lists.indexOf(this, element, start, this.length);
+
+ int lastIndexOf(Node element, [int start = 0]) =>
+ _Lists.lastIndexOf(this, element, start);
+
+ // FIXME: implement thesee.
+ void setRange(int start, int length, List<Node> from, [int startFrom]) {
+ throw new UnsupportedOperationException(
+ "Cannot setRange on immutable List.");
+ }
+ void removeRange(int start, int length) {
+ throw new UnsupportedOperationException(
+ "Cannot removeRange on immutable List.");
+ }
+ void insertRange(int start, int length, [Node initialValue]) {
+ throw new UnsupportedOperationException(
+ "Cannot insertRange on immutable List.");
+ }
+ NodeList getRange(int start, int length) =>
+ new _NodeListWrapper(_Lists.getRange(this, start, length, <Node>[]));
+
+ // -- end List<Node> mixins.
+
+ // TODO(jacobr): benchmark whether this is more efficient or whether caching
+ // a local copy of $dom_childNodes is more efficient.
+ int get length() => _this.$dom_childNodes.length;
+
+ _NodeImpl operator[](int index) => _this.$dom_childNodes[index];
+}
+
class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
- _NodeListImpl get nodes() {
- final list = _childNodes;
- list._parent = this;
- return list;
+ _ChildNodeListLazy get nodes() {
+ return new _ChildNodeListLazy(this);
}
void set nodes(Collection<Node> value) {
@@ -8661,7 +8784,7 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
List copy = new List.from(value);
text = '';
for (Node node in copy) {
- _appendChild(node);
+ $dom_appendChild(node);
}
}
@@ -8669,7 +8792,7 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
_NodeImpl remove() {
if (this.parent != null) {
final _NodeImpl parent = this.parent;
- parent._removeChild(this);
+ parent.$dom_removeChild(this);
}
return this;
}
@@ -8677,7 +8800,7 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
_NodeImpl replaceWith(Node otherNode) {
try {
final _NodeImpl parent = this.parent;
- parent._replaceChild(otherNode, this);
+ parent.$dom_replaceChild(otherNode, this);
} catch(var e) {
};
@@ -8721,15 +8844,19 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
static final int TEXT_NODE = 3;
- _NamedNodeMapImpl get _attributes() native "return this.attributes;";
+ _NamedNodeMapImpl get $dom_attributes() native "return this.attributes;";
+
+ _NodeListImpl get $dom_childNodes() native "return this.childNodes;";
- _NodeListImpl get _childNodes() native "return this.childNodes;";
+ _NodeImpl get $dom_firstChild() native "return this.firstChild;";
+
+ _NodeImpl get $dom_lastChild() native "return this.lastChild;";
_NodeImpl get nextNode() native "return this.nextSibling;";
- _DocumentImpl get document() => _FixHtmlDocumentReference(_document);
+ int get $dom_nodeType() native "return this.nodeType;";
- _EventTargetImpl get _document() native "return this.ownerDocument;";
+ _DocumentImpl get document() native "return this.ownerDocument;";
_NodeImpl get parent() native "return this.parentNode;";
@@ -8739,7 +8866,7 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
void set text(String value) native "this.textContent = value;";
- _NodeImpl _appendChild(_NodeImpl newChild) native "return this.appendChild(newChild);";
+ _NodeImpl $dom_appendChild(_NodeImpl newChild) native "return this.appendChild(newChild);";
_NodeImpl clone(bool deep) native "return this.cloneNode(deep);";
@@ -8749,9 +8876,9 @@ class _NodeImpl extends _EventTargetImpl implements Node native "*Node" {
_NodeImpl insertBefore(_NodeImpl newChild, _NodeImpl refChild) native;
- _NodeImpl _removeChild(_NodeImpl oldChild) native "return this.removeChild(oldChild);";
+ _NodeImpl $dom_removeChild(_NodeImpl oldChild) native "return this.removeChild(oldChild);";
- _NodeImpl _replaceChild(_NodeImpl newChild, _NodeImpl oldChild) native "return this.replaceChild(newChild, oldChild);";
+ _NodeImpl $dom_replaceChild(_NodeImpl newChild, _NodeImpl oldChild) native "return this.replaceChild(newChild, oldChild);";
}
@@ -8909,23 +9036,23 @@ class _NodeListImpl implements NodeList native "*NodeList" {
// From Collection<Node>:
void add(_NodeImpl value) {
- _parent._appendChild(value);
+ _parent.$dom_appendChild(value);
}
void addLast(_NodeImpl value) {
- _parent._appendChild(value);
+ _parent.$dom_appendChild(value);
}
void addAll(Collection<_NodeImpl> collection) {
for (_NodeImpl node in collection) {
- _parent._appendChild(node);
+ _parent.$dom_appendChild(node);
}
}
_NodeImpl removeLast() {
final last = this.last();
if (last != null) {
- _parent._removeChild(last);
+ _parent.$dom_removeChild(last);
}
return last;
}
@@ -8935,7 +9062,7 @@ class _NodeListImpl implements NodeList native "*NodeList" {
}
void operator []=(int index, _NodeImpl value) {
- _parent._replaceChild(value, this[index]);
+ _parent.$dom_replaceChild(value, this[index]);
}
void forEach(void f(Node element)) => _Collections.forEach(this, f);
@@ -8992,7 +9119,7 @@ class _NodeSelectorImpl implements NodeSelector native "*NodeSelector" {
_ElementImpl query(String selectors) native "return this.querySelector(selectors);";
- _NodeListImpl _querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
+ _NodeListImpl $dom_querySelectorAll(String selectors) native "return this.querySelectorAll(selectors);";
}
class _NotationImpl extends _NodeImpl implements Notation native "*Notation" {
@@ -9085,9 +9212,7 @@ class _ObjectElementImpl extends _ElementImpl implements ObjectElement native "*
String codeType;
- _DocumentImpl get contentDocument() => _FixHtmlDocumentReference(_contentDocument);
-
- _EventTargetImpl get _contentDocument() native "return this.contentDocument;";
+ final _DocumentImpl contentDocument;
String data;
@@ -9672,7 +9797,7 @@ class _SVGAElementImpl extends _SVGElementImpl implements SVGAElement native "*S
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -9901,7 +10026,7 @@ class _SVGCircleElementImpl extends _SVGElementImpl implements SVGCircleElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -9953,7 +10078,7 @@ class _SVGClipPathElementImpl extends _SVGElementImpl implements SVGClipPathElem
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10078,7 +10203,7 @@ class _SVGDefsElementImpl extends _SVGElementImpl implements SVGDefsElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10114,7 +10239,7 @@ class _SVGDescElementImpl extends _SVGElementImpl implements SVGDescElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10126,7 +10251,7 @@ class _SVGDocumentImpl extends _DocumentImpl implements SVGDocument native "*SVG
final _SVGSVGElementImpl rootElement;
- _EventImpl _createEvent(String eventType) native "return this.createEvent(eventType);";
+ _EventImpl $dom_createEvent(String eventType) native "return this.createEvent(eventType);";
}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -10135,7 +10260,7 @@ class _SVGDocumentImpl extends _DocumentImpl implements SVGDocument native "*SVG
class _AttributeClassSet extends _CssClassSet {
_AttributeClassSet(element) : super(element);
- String _className() => _element.attributes['class'];
+ String $dom_className() => _element.attributes['class'];
void _write(Set s) {
_element.attributes['class'] = _formatSet(s);
@@ -10215,11 +10340,11 @@ class _SVGElementInstanceImpl extends _EventTargetImpl implements SVGElementInst
final _SVGElementInstanceImpl previousSibling;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl event) native "return this.dispatchEvent(event);";
+ bool $dom_dispatchEvent(_EventImpl event) native "return this.dispatchEvent(event);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
}
class _SVGElementInstanceEventsImpl extends _EventsImpl implements SVGElementInstanceEvents {
@@ -10345,7 +10470,7 @@ class _SVGEllipseElementImpl extends _SVGElementImpl implements SVGEllipseElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10427,7 +10552,7 @@ class _SVGFEBlendElementImpl extends _SVGElementImpl implements SVGFEBlendElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10467,7 +10592,7 @@ class _SVGFEColorMatrixElementImpl extends _SVGElementImpl implements SVGFEColor
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10493,7 +10618,7 @@ class _SVGFEComponentTransferElementImpl extends _SVGElementImpl implements SVGF
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10545,7 +10670,7 @@ class _SVGFECompositeElementImpl extends _SVGElementImpl implements SVGFEComposi
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10601,7 +10726,7 @@ class _SVGFEConvolveMatrixElementImpl extends _SVGElementImpl implements SVGFECo
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10635,7 +10760,7 @@ class _SVGFEDiffuseLightingElementImpl extends _SVGElementImpl implements SVGFED
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10679,7 +10804,7 @@ class _SVGFEDisplacementMapElementImpl extends _SVGElementImpl implements SVGFED
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10722,7 +10847,7 @@ class _SVGFEDropShadowElementImpl extends _SVGElementImpl implements SVGFEDropSh
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10746,7 +10871,7 @@ class _SVGFEFloodElementImpl extends _SVGElementImpl implements SVGFEFloodElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10790,7 +10915,7 @@ class _SVGFEGaussianBlurElementImpl extends _SVGElementImpl implements SVGFEGaus
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10830,7 +10955,7 @@ class _SVGFEImageElementImpl extends _SVGElementImpl implements SVGFEImageElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10854,7 +10979,7 @@ class _SVGFEMergeElementImpl extends _SVGElementImpl implements SVGFEMergeElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10899,7 +11024,7 @@ class _SVGFEMorphologyElementImpl extends _SVGElementImpl implements SVGFEMorpho
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10929,7 +11054,7 @@ class _SVGFEOffsetElementImpl extends _SVGElementImpl implements SVGFEOffsetElem
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -10970,7 +11095,7 @@ class _SVGFESpecularLightingElementImpl extends _SVGElementImpl implements SVGFE
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11015,7 +11140,7 @@ class _SVGFETileElementImpl extends _SVGElementImpl implements SVGFETileElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11063,7 +11188,7 @@ class _SVGFETurbulenceElementImpl extends _SVGElementImpl implements SVGFETurbul
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11107,7 +11232,7 @@ class _SVGFilterElementImpl extends _SVGElementImpl implements SVGFilterElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11185,7 +11310,7 @@ class _SVGForeignObjectElementImpl extends _SVGElementImpl implements SVGForeign
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11235,7 +11360,7 @@ class _SVGGElementImpl extends _SVGElementImpl implements SVGGElement native "*S
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11284,7 +11409,7 @@ class _SVGGlyphRefElementImpl extends _SVGElementImpl implements SVGGlyphRefElem
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11318,7 +11443,7 @@ class _SVGGradientElementImpl extends _SVGElementImpl implements SVGGradientElem
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11367,7 +11492,7 @@ class _SVGImageElementImpl extends _SVGElementImpl implements SVGImageElement na
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11488,7 +11613,7 @@ class _SVGLineElementImpl extends _SVGElementImpl implements SVGLineElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11595,7 +11720,7 @@ class _SVGMarkerElementImpl extends _SVGElementImpl implements SVGMarkerElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11645,7 +11770,7 @@ class _SVGMaskElementImpl extends _SVGElementImpl implements SVGMaskElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -11829,7 +11954,7 @@ class _SVGPathElementImpl extends _SVGElementImpl implements SVGPathElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12136,7 +12261,7 @@ class _SVGPatternElementImpl extends _SVGElementImpl implements SVGPatternElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12206,7 +12331,7 @@ class _SVGPolygonElementImpl extends _SVGElementImpl implements SVGPolygonElemen
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12260,7 +12385,7 @@ class _SVGPolylineElementImpl extends _SVGElementImpl implements SVGPolylineElem
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12381,7 +12506,7 @@ class _SVGRectElementImpl extends _SVGElementImpl implements SVGRectElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12520,7 +12645,7 @@ class _SVGSVGElementImpl extends _SVGElementImpl implements SVGSVGElement native
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12574,7 +12699,7 @@ class _SVGStopElementImpl extends _SVGElementImpl implements SVGStopElement nati
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12603,7 +12728,7 @@ class _SVGStringListImpl implements SVGStringList native "*SVGStringList" {
class _SVGStylableImpl implements SVGStylable native "*SVGStylable" {
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_svgClassName() native "return this.className;";
final _CSSStyleDeclarationImpl style;
@@ -12654,7 +12779,7 @@ class _SVGSwitchElementImpl extends _SVGElementImpl implements SVGSwitchElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12694,7 +12819,7 @@ class _SVGSymbolElementImpl extends _SVGElementImpl implements SVGSymbolElement
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12781,7 +12906,7 @@ class _SVGTextContentElementImpl extends _SVGElementImpl implements SVGTextConte
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12858,7 +12983,7 @@ class _SVGTitleElementImpl extends _SVGElementImpl implements SVGTitleElement na
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -12983,7 +13108,7 @@ class _SVGUseElementImpl extends _SVGElementImpl implements SVGUseElement native
// From SVGStylable
- _SVGAnimatedStringImpl get _svgClassName() native "return this.className;";
+ _SVGAnimatedStringImpl get $dom_$dom_svgClassName() native "return this.className;";
// Use implementation from Element.
// final _CSSStyleDeclarationImpl style;
@@ -13873,9 +13998,7 @@ class _TouchImpl implements Touch native "*Touch" {
final int screenY;
- _EventTargetImpl get target() => _FixHtmlDocumentReference(_target);
-
- _EventTargetImpl get _target() native "return this.target;";
+ final _EventTargetImpl target;
final num webkitForce;
@@ -15418,13 +15541,13 @@ class _WebSocketImpl extends _EventTargetImpl implements WebSocket native "*WebS
final String url;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
void close([int code = null, String reason = null]) native;
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
bool send(String data) native;
}
@@ -15483,7 +15606,7 @@ class _WheelEventImpl extends _UIEventImpl implements WheelEvent native "*WheelE
class _WindowImpl extends _EventTargetImpl implements Window native "@*DOMWindow" {
- _DocumentImpl get document() native "return this.document.documentElement;";
+ _DocumentImpl get document() native "return this.document;";
void requestLayoutFrame(TimeoutHandler callback) {
_addMeasurementFrameCallback(callback);
@@ -15595,7 +15718,7 @@ class _WindowImpl extends _EventTargetImpl implements Window native "@*DOMWindow
final _WindowImpl window;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
void alert(String message) native;
@@ -15615,13 +15738,13 @@ class _WindowImpl extends _EventTargetImpl implements Window native "@*DOMWindow
bool confirm(String message) native;
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
bool find(String string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) native;
void focus() native;
- _CSSStyleDeclarationImpl _getComputedStyle(_ElementImpl element, String pseudoElement) native "return this.getComputedStyle(element, pseudoElement);";
+ _CSSStyleDeclarationImpl $dom_getComputedStyle(_ElementImpl element, String pseudoElement) native "return this.getComputedStyle(element, pseudoElement);";
_CSSRuleListImpl getMatchedCSSRules(_ElementImpl element, String pseudoElement) native;
@@ -15645,7 +15768,7 @@ class _WindowImpl extends _EventTargetImpl implements Window native "@*DOMWindow
void releaseEvents() native;
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
void resizeBy(num x, num y) native;
@@ -15963,9 +16086,7 @@ class _XMLHttpRequestImpl extends _EventTargetImpl implements XMLHttpRequest nat
String responseType;
- _DocumentImpl get responseXML() => _FixHtmlDocumentReference(_responseXML);
-
- _EventTargetImpl get _responseXML() native "return this.responseXML;";
+ final _DocumentImpl responseXML;
final int status;
@@ -15977,9 +16098,9 @@ class _XMLHttpRequestImpl extends _EventTargetImpl implements XMLHttpRequest nat
void abort() native;
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
String getAllResponseHeaders() native;
@@ -15989,7 +16110,7 @@ class _XMLHttpRequestImpl extends _EventTargetImpl implements XMLHttpRequest nat
void overrideMimeType(String override) native;
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
void send([var data = null]) native;
@@ -16041,11 +16162,11 @@ class _XMLHttpRequestUploadImpl extends _EventTargetImpl implements XMLHttpReque
_XMLHttpRequestUploadEventsImpl get on() =>
new _XMLHttpRequestUploadEventsImpl(this);
- void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
- bool _dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
+ bool $dom_dispatchEvent(_EventImpl evt) native "return this.dispatchEvent(evt);";
- void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
}
class _XMLHttpRequestUploadEventsImpl extends _EventsImpl implements XMLHttpRequestUploadEvents {
@@ -16158,9 +16279,7 @@ class _XSLTProcessorImpl implements XSLTProcessor native "*XSLTProcessor" {
void setParameter(String namespaceURI, String localName, String value) native;
- _DocumentImpl transformToDocument(_NodeImpl source) => _FixHtmlDocumentReference(_transformToDocument(source));
-
- _EventTargetImpl _transformToDocument(_NodeImpl source) native "return this.transformToDocument(source);";
+ _DocumentImpl transformToDocument(_NodeImpl source) native;
_DocumentFragmentImpl transformToFragment(_NodeImpl source, _DocumentImpl docVal) native;
}
@@ -16409,6 +16528,12 @@ class _XSLTProcessorFactoryProvider {
interface AbstractWorker extends EventTarget {
AbstractWorkerEvents get on();
+
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event evt);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
}
interface AbstractWorkerEvents extends Events {
@@ -19919,6 +20044,12 @@ interface DOMApplicationCache extends EventTarget {
void abort();
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event evt);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
void swapCache();
void update();
@@ -20562,6 +20693,8 @@ interface Document extends HtmlElement {
final Window window;
+ final Element documentElement;
+
final String domain;
final HeadElement head;
@@ -20600,16 +20733,34 @@ interface Document extends HtmlElement {
DocumentFragment createDocumentFragment();
+ Element $dom_createElement(String tagName);
+
+ Element $dom_createElementNS(String namespaceURI, String qualifiedName);
+
+ Event $dom_createEvent(String eventType);
+
Range createRange();
+ Text $dom_createTextNode(String data);
+
Touch createTouch(Window window, EventTarget target, int identifier, int pageX, int pageY, int screenX, int screenY, int webkitRadiusX, int webkitRadiusY, num webkitRotationAngle, num webkitForce);
+ TouchList $dom_createTouchList();
+
Element elementFromPoint(int x, int y);
bool execCommand(String command, bool userInterface, String value);
CanvasRenderingContext getCSSCanvasContext(String contextId, String name, int width, int height);
+ Element $dom_getElementById(String elementId);
+
+ NodeList $dom_getElementsByClassName(String tagname);
+
+ NodeList $dom_getElementsByName(String elementName);
+
+ NodeList $dom_getElementsByTagName(String tagname);
+
bool queryCommandEnabled(String command);
bool queryCommandIndeterm(String command);
@@ -20620,6 +20771,10 @@ interface Document extends HtmlElement {
String queryCommandValue(String command);
+ Element query(String selectors);
+
+ NodeList $dom_querySelectorAll(String selectors);
+
void webkitCancelFullScreen();
void webkitExitFullscreen();
@@ -20747,6 +20902,8 @@ interface DocumentFragment extends Element default _DocumentFragmentFactoryProvi
Element query(String selectors);
+ NodeList $dom_querySelectorAll(String selectors);
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -20808,21 +20965,21 @@ interface EXTTextureFilterAnisotropic {
*/
class _DataAttributeMap implements Map<String, String> {
- final Map<String, String> _attributes;
+ final Map<String, String> $dom_attributes;
- _DataAttributeMap(this._attributes);
+ _DataAttributeMap(this.$dom_attributes);
// interface Map
// TODO: Use lazy iterator when it is available on Map.
bool containsValue(String value) => getValues().some((v) => v == value);
- bool containsKey(String key) => _attributes.containsKey(_attr(key));
+ bool containsKey(String key) => $dom_attributes.containsKey(_attr(key));
- String operator [](String key) => _attributes[_attr(key)];
+ String operator [](String key) => $dom_attributes[_attr(key)];
void operator []=(String key, String value) {
- _attributes[_attr(key)] = value;
+ $dom_attributes[_attr(key)] = value;
}
String putIfAbsent(String key, String ifAbsent()) {
@@ -20832,7 +20989,7 @@ class _DataAttributeMap implements Map<String, String> {
return this[key];
}
- String remove(String key) => _attributes.remove(_attr(key));
+ String remove(String key) => $dom_attributes.remove(_attr(key));
void clear() {
// Needs to operate on a snapshot since we are mutatiting the collection.
@@ -20842,7 +20999,7 @@ class _DataAttributeMap implements Map<String, String> {
}
void forEach(void f(String key, String value)) {
- _attributes.forEach((String key, String value) {
+ $dom_attributes.forEach((String key, String value) {
if (_matches(key)) {
f(_strip(key), value);
}
@@ -20851,7 +21008,7 @@ class _DataAttributeMap implements Map<String, String> {
Collection<String> getKeys() {
final keys = new List<String>();
- _attributes.forEach((String key, String value) {
+ $dom_attributes.forEach((String key, String value) {
if (_matches(key)) {
keys.add(_strip(key));
}
@@ -20861,7 +21018,7 @@ class _DataAttributeMap implements Map<String, String> {
Collection<String> getValues() {
final values = new List<String>();
- _attributes.forEach((String key, String value) {
+ $dom_attributes.forEach((String key, String value) {
if (_matches(key)) {
values.add(value);
}
@@ -20992,7 +21149,7 @@ class _CssClassSet implements Set<String> {
Set<String> _read() {
// TODO(mattsh) simplify this once split can take regex.
Set<String> s = new Set<String>();
- for (String name in _className().split(' ')) {
+ for (String name in $dom_className().split(' ')) {
String trimmed = name.trim();
if (!trimmed.isEmpty()) {
s.add(trimmed);
@@ -21005,14 +21162,14 @@ class _CssClassSet implements Set<String> {
* Read the class names as a space-separated string. This is meant to be
* overridden by subclasses.
*/
- String _className() => _element._className;
+ String $dom_className() => _element.$dom_className;
/**
* Join all the elements of a set into one string and write
* back to the element.
*/
void _write(Set s) {
- _element._className = _formatSet(s);
+ _element.$dom_className = _formatSet(s);
}
String _formatSet(Set<String> s) {
@@ -21099,12 +21256,28 @@ interface Element extends Node, NodeSelector default _ElementFactoryProvider {
static final int ALLOW_KEYBOARD_INPUT = 1;
+ final int $dom_childElementCount;
+
+ final HTMLCollection $dom_children;
+
+ String $dom_className;
+
+ final int $dom_clientHeight;
+
+ final int $dom_clientLeft;
+
+ final int $dom_clientTop;
+
+ final int $dom_clientWidth;
+
String contentEditable;
String dir;
bool draggable;
+ final Element $dom_firstElementChild;
+
bool hidden;
String id;
@@ -21115,16 +21288,32 @@ interface Element extends Node, NodeSelector default _ElementFactoryProvider {
String lang;
- final Element lastElementChild;
+ final Element $dom_lastElementChild;
final Element nextElementSibling;
+ final int $dom_offsetHeight;
+
+ final int $dom_offsetLeft;
+
final Element offsetParent;
+ final int $dom_offsetTop;
+
+ final int $dom_offsetWidth;
+
final String outerHTML;
final Element previousElementSibling;
+ final int $dom_scrollHeight;
+
+ int $dom_scrollLeft;
+
+ int $dom_scrollTop;
+
+ final int $dom_scrollWidth;
+
bool spellcheck;
final CSSStyleDeclaration style;
@@ -21147,6 +21336,18 @@ interface Element extends Node, NodeSelector default _ElementFactoryProvider {
void focus();
+ String $dom_getAttribute(String name);
+
+ ClientRect $dom_getBoundingClientRect();
+
+ ClientRectList $dom_getClientRects();
+
+ NodeList $dom_getElementsByClassName(String name);
+
+ NodeList $dom_getElementsByTagName(String name);
+
+ bool $dom_hasAttribute(String name);
+
Element insertAdjacentElement(String where, Element element);
void insertAdjacentHTML(String where, String html);
@@ -21155,12 +21356,18 @@ interface Element extends Node, NodeSelector default _ElementFactoryProvider {
Element query(String selectors);
+ NodeList $dom_querySelectorAll(String selectors);
+
+ void $dom_removeAttribute(String name);
+
void scrollByLines(int lines);
void scrollByPages(int pages);
void scrollIntoView([bool centerIfNeeded]);
+ void $dom_setAttribute(String name, String value);
+
bool matchesSelector(String selectors);
void webkitRequestFullScreen(int flags);
@@ -21538,6 +21745,8 @@ interface Event default _EventFactoryProvider {
final String type;
+ void $dom_initEvent(String eventTypeArg, bool canBubbleArg, bool cancelableArg);
+
void preventDefault();
void stopImmediatePropagation();
@@ -21588,7 +21797,13 @@ interface EventSource extends EventTarget default _EventSourceFactoryProvider {
final String url;
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
void close();
+
+ bool $dom_dispatchEvent(Event evt);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
}
interface EventSourceEvents extends Events {
@@ -21621,6 +21836,12 @@ interface EventTarget {
final Events on;
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event event);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -23548,10 +23769,16 @@ interface MessagePort extends EventTarget {
MessagePortEvents get on();
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
void close();
+ bool $dom_dispatchEvent(Event evt);
+
void postMessage(String message, [List messagePorts]);
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
void start();
void webkitPostMessage(String message, [List transfer]);
@@ -23677,6 +23904,8 @@ interface MouseEvent extends UIEvent default _MouseEventFactoryProvider {
final int x;
final int y;
+
+ void $dom_initMouseEvent(String type, bool canBubble, bool cancelable, Window view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, int button, EventTarget relatedTarget);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -23852,8 +24081,18 @@ interface Node extends EventTarget {
static final int TEXT_NODE = 3;
+ final NamedNodeMap $dom_attributes;
+
+ final NodeList $dom_childNodes;
+
+ final Node $dom_firstChild;
+
+ final Node $dom_lastChild;
+
final Node nextNode;
+ final int $dom_nodeType;
+
final Document document;
final Node parent;
@@ -23862,6 +24101,8 @@ interface Node extends EventTarget {
String text;
+ Node $dom_appendChild(Node newChild);
+
Node clone(bool deep);
bool contains(Node other);
@@ -23870,6 +24111,10 @@ interface Node extends EventTarget {
Node insertBefore(Node newChild, Node refChild);
+ Node $dom_removeChild(Node oldChild);
+
+ Node $dom_replaceChild(Node newChild, Node oldChild);
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -23971,6 +24216,8 @@ interface NodeSelector {
Element query(String selectors);
+ NodeList $dom_querySelectorAll(String selectors);
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25258,6 +25505,8 @@ interface SVGDescElement extends SVGElement, SVGLangSpace, SVGStylable {
interface SVGDocument extends Document {
final SVGSVGElement rootElement;
+
+ Event $dom_createEvent(String eventType);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25305,6 +25554,12 @@ interface SVGElementInstance extends EventTarget {
final SVGElementInstance parentNode;
final SVGElementInstance previousSibling;
+
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event event);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
}
interface SVGElementInstanceEvents extends Events {
@@ -27157,6 +27412,8 @@ interface SVGStringList {
interface SVGStylable {
+ final SVGAnimatedString $dom_svgClassName;
+
final CSSStyleDeclaration style;
CSSValue getPresentationAttribute(String name);
@@ -29955,8 +30212,14 @@ interface WebSocket extends EventTarget default _WebSocketFactoryProvider {
final String url;
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
void close([int code, String reason]);
+ bool $dom_dispatchEvent(Event evt);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
bool send(String data);
}
@@ -30134,6 +30397,8 @@ interface Window extends EventTarget {
final Window window;
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
void alert(String message);
String atob(String string);
@@ -30152,10 +30417,14 @@ interface Window extends EventTarget {
bool confirm(String message);
+ bool $dom_dispatchEvent(Event evt);
+
bool find(String string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog);
void focus();
+ CSSStyleDeclaration $dom_getComputedStyle(Element element, String pseudoElement);
+
CSSRuleList getMatchedCSSRules(Element element, String pseudoElement);
DOMSelection getSelection();
@@ -30178,6 +30447,8 @@ interface Window extends EventTarget {
void releaseEvents();
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
void resizeBy(num x, num y);
void resizeTo(num width, num height);
@@ -30534,6 +30805,10 @@ interface XMLHttpRequest extends EventTarget default _XMLHttpRequestFactoryProvi
void abort();
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event evt);
+
String getAllResponseHeaders();
String getResponseHeader(String header);
@@ -30542,6 +30817,8 @@ interface XMLHttpRequest extends EventTarget default _XMLHttpRequestFactoryProvi
void overrideMimeType(String override);
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
+
void send([var data]);
void setRequestHeader(String header, String value);
@@ -30604,6 +30881,12 @@ interface XMLHttpRequestProgressEvent extends ProgressEvent {
interface XMLHttpRequestUpload extends EventTarget {
XMLHttpRequestUploadEvents get on();
+
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);
+
+ bool $dom_dispatchEvent(Event evt);
+
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]);
}
interface XMLHttpRequestUploadEvents extends Events {
@@ -31537,16 +31820,11 @@ void _completeMeasurementFutures() {
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class _TextFactoryProvider {
-
- factory Text(String data) => _document._createTextNode(data);
-}
-
class _EventFactoryProvider {
factory Event(String type, [bool canBubble = true,
bool cancelable = true]) {
- final _EventImpl e = _document._createEvent("Event");
- e._initEvent(type, canBubble, cancelable);
+ final _EventImpl e = _document.$dom_createEvent("Event");
+ e.$dom_initEvent(type, canBubble, cancelable);
return e;
}
}
@@ -31557,8 +31835,8 @@ class _MouseEventFactoryProvider {
[bool canBubble = true, bool cancelable = true, bool ctrlKey = false,
bool altKey = false, bool shiftKey = false, bool metaKey = false,
EventTarget relatedTarget = null]) {
- final e = _document._createEvent("MouseEvent");
- e._initMouseEvent(type, canBubble, cancelable, view, detail,
+ final e = _document.$dom_createEvent("MouseEvent");
+ e.$dom_initMouseEvent(type, canBubble, cancelable, view, detail,
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
button, relatedTarget);
return e;
@@ -31577,62 +31855,6 @@ class _CSSStyleDeclarationFactoryProvider {
}
}
-final _START_TAG_REGEXP = const RegExp('<(\\w+)');
-class _ElementFactoryProvider {
- static final _CUSTOM_PARENT_TAG_MAP = const {
- 'body' : 'html',
- 'head' : 'html',
- 'caption' : 'table',
- 'td': 'tr',
- 'colgroup': 'table',
- 'col' : 'colgroup',
- 'tr' : 'tbody',
- 'tbody' : 'table',
- 'tfoot' : 'table',
- 'thead' : 'table',
- 'track' : 'audio',
- };
-
- /** @domName Document.createElement */
- factory Element.html(String html) {
- // TODO(jacobr): this method can be made more robust and performant.
- // 1) Cache the dummy parent elements required to use innerHTML rather than
- // creating them every call.
- // 2) Verify that the html does not contain leading or trailing text nodes.
- // 3) Verify that the html does not contain both <head> and <body> tags.
- // 4) Detatch the created element from its dummy parent.
- String parentTag = 'div';
- String tag;
- final match = _START_TAG_REGEXP.firstMatch(html);
- if (match !== null) {
- tag = match.group(1).toLowerCase();
- if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) {
- parentTag = _CUSTOM_PARENT_TAG_MAP[tag];
- }
- }
- final _ElementImpl temp = new Element.tag(parentTag);
- temp.innerHTML = html;
-
- Element element;
- if (temp.elements.length == 1) {
- element = temp.elements.first;
- } else if (parentTag == 'html' && temp.elements.length == 2) {
- // Work around for edge case in WebKit and possibly other browsers where
- // both body and head elements are created even though the inner html
- // only contains a head or body element.
- element = temp.elements[tag == 'head' ? 0 : 1];
- } else {
- throw new IllegalArgumentException('HTML had ${temp.elements.length} ' +
- 'top level elements but 1 expected');
- }
- element.remove();
- return element;
- }
-
- /** @domName Document.createElement */
- factory Element.tag(String tag) => _document._createElement(tag);
-}
-
class _DocumentFragmentFactoryProvider {
/** @domName Document.createDocumentFragment */
factory DocumentFragment() => document.createDocumentFragment();
@@ -31670,7 +31892,7 @@ class _DocumentFragmentFactoryProvider {
class _SVGElementFactoryProvider {
factory SVGElement.tag(String tag) {
final Element temp =
- _document._createElementNS("http://www.w3.org/2000/svg", tag);
+ _document.$dom_createElementNS("http://www.w3.org/2000/svg", tag);
return temp;
}
@@ -31771,22 +31993,27 @@ class _WebSocketFactoryProvider {
factory WebSocket(String url) native '''return new WebSocket(url);''';
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+
+class _TextFactoryProvider {
+ factory Text(String data) native "return document.createTextNode(data);";
+}// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// TODO(rnystrom): add a way to supress public classes from DartDoc output.
+// TODO(jacobr): we can remove this class now that we are using the $dom_
+// convention for deprecated methods rather than truly private methods.
/**
* This class is intended for testing purposes only.
*/
class Testing {
static void addEventListener(EventTarget target, String type, EventListener listener, bool useCapture) {
final _EventTargetImpl targetImpl = target;
- targetImpl._addEventListener(type, listener, useCapture);
+ targetImpl.$dom_addEventListener(type, listener, useCapture);
}
static void removeEventListener(EventTarget target, String type, EventListener listener, bool useCapture) {
final _EventTargetImpl targetImpl = target;
- targetImpl._removeEventListener(type, listener, useCapture);
+ targetImpl.$dom_removeEventListener(type, listener, useCapture);
}
}// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file

Powered by Google App Engine
This is Rietveld 408576698