Version 1.2.0-dev.5.7
svn merge -c 32666 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32678 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
tools/dom/scripts/go.sh
R=ricow@google.com
Review URL: https://codereview.chromium.org//166213002
git-svn-id: http://dart.googlecode.com/svn/trunk@32688 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/custom_element/lib/custom_element.dart b/pkg/custom_element/lib/custom_element.dart
index 5057eb1..43366bc 100644
--- a/pkg/custom_element/lib/custom_element.dart
+++ b/pkg/custom_element/lib/custom_element.dart
@@ -249,8 +249,6 @@
host.createFragment(html,
validator: validator, treeSanitizer: treeSanitizer);
- InputMethodContext get inputMethodContext => host.inputMethodContext;
-
bool get isContentEditable => host.isContentEditable;
String get lang => host.lang;
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 729b216..187a24b 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -111,7 +111,7 @@
@DocsEditable()
@DomName('AbstractWorker')
-class AbstractWorker extends Interceptor implements EventTarget native "AbstractWorker" {
+abstract class AbstractWorker extends Interceptor implements EventTarget native "AbstractWorker" {
// To suppress missing implicit constructor warnings.
factory AbstractWorker._() { throw new UnsupportedError("Not supported"); }
@@ -266,6 +266,12 @@
@DocsEditable()
String href;
+ @DomName('HTMLAnchorElement.origin')
+ @DocsEditable()
+ // WebKit only
+ @Experimental() // non-standard
+ final String origin;
+
@DomName('HTMLAnchorElement.password')
@DocsEditable()
@Experimental() // untriaged
@@ -7843,16 +7849,19 @@
validator: validator, treeSanitizer: treeSanitizer);
}
+ HtmlCollection get _children => throw new UnimplementedError(
+ 'Use _docChildren instead');
+
// Native field is used only by Dart code so does not lead to instantiation
// of native classes
@Creates('Null')
- List<Element> _children;
+ List<Element> _docChildren;
List<Element> get children {
- if (_children == null) {
- _children = new FilteredElementList(this);
+ if (_docChildren == null) {
+ _docChildren = new FilteredElementList(this);
}
- return _children;
+ return _docChildren;
}
void set children(List<Element> value) {
@@ -7985,21 +7994,6 @@
@DocsEditable()
-@DomName('DocumentType')
-// http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-412266927
-@deprecated // stable
-class DocumentType extends Node implements ChildNode native "DocumentType" {
- // To suppress missing implicit constructor warnings.
- factory DocumentType._() { throw new UnsupportedError("Not supported"); }
-
- // From ChildNode
-}
-// 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.
-
-
-@DocsEditable()
@DomName('DOMError')
class DomError extends Interceptor native "DOMError" {
// To suppress missing implicit constructor warnings.
@@ -8086,11 +8080,11 @@
@DomName('DOMImplementation.createDocument')
@DocsEditable()
- Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) native;
+ Document createDocument(String namespaceURI, String qualifiedName, _DocumentType doctype) native;
@DomName('DOMImplementation.createDocumentType')
@DocsEditable()
- DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) native;
+ _DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) native;
@JSName('createHTMLDocument')
@DomName('DOMImplementation.createHTMLDocument')
@@ -10901,19 +10895,6 @@
@DocsEditable()
bool hidden;
- /**
- * The current state of IME composition.
- *
- * ## Other resources
- *
- * * [Input method editor specification]
- * (http://www.w3.org/TR/ime-api/) from W3C.
- */
- @DomName('Element.inputMethodContext')
- @DocsEditable()
- @Experimental() // untriaged
- final InputMethodContext inputMethodContext;
-
@DomName('Element.isContentEditable')
@DocsEditable()
final bool isContentEditable;
@@ -14512,10 +14493,6 @@
class HtmlFormControlsCollection extends HtmlCollection native "HTMLFormControlsCollection" {
// To suppress missing implicit constructor warnings.
factory HtmlFormControlsCollection._() { throw new UnsupportedError("Not supported"); }
-
- @DomName('HTMLFormControlsCollection.__getter__')
- @DocsEditable()
- Node __getter__(int index) 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
@@ -29177,6 +29154,15 @@
String getEventType(EventTarget target) {
return _eventType;
}
+
+ ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, 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
@@ -29206,11 +29192,6 @@
// To suppress missing implicit constructor warnings.
factory WindowEventHandlers._() { throw new UnsupportedError("Not supported"); }
- @DomName('WindowEventHandlers.beforeunloadEvent')
- @DocsEditable()
- @Experimental() // untriaged
- static const EventStreamProvider<Event> beforeUnloadEvent = const EventStreamProvider<Event>('beforeunload');
-
@DomName('WindowEventHandlers.hashchangeEvent')
@DocsEditable()
@Experimental() // untriaged
@@ -29251,11 +29232,6 @@
@Experimental() // untriaged
static const EventStreamProvider<Event> unloadEvent = const EventStreamProvider<Event>('unload');
- @DomName('WindowEventHandlers.onbeforeunload')
- @DocsEditable()
- @Experimental() // untriaged
- Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);
-
@DomName('WindowEventHandlers.onhashchange')
@DocsEditable()
@Experimental() // untriaged
@@ -30334,6 +30310,21 @@
@DocsEditable()
+@DomName('DocumentType')
+// http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-412266927
+@deprecated // stable
+abstract class _DocumentType extends Node implements ChildNode native "DocumentType" {
+ // To suppress missing implicit constructor warnings.
+ factory _DocumentType._() { throw new UnsupportedError("Not supported"); }
+
+ // From ChildNode
+}
+// 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.
+
+
+@DocsEditable()
@DomName('WebKitPoint')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@@ -32656,6 +32647,9 @@
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
+
+ String get _eventType =>
+ throw new UnsupportedError('Access type through getEventType method.');
}
// DO NOT EDIT- this file is generated from running tool/generator.sh.
@@ -34890,6 +34884,10 @@
*/
class _WrappedEvent implements Event {
final Event wrapped;
+
+ /** The CSS selector involved with event delegation. */
+ String _selector;
+
_WrappedEvent(this.wrapped);
bool get bubbles => wrapped.bubbles;
@@ -34927,6 +34925,43 @@
void stopPropagation() {
wrapped.stopPropagation();
}
+
+ /**
+ * A pointer to the element whose CSS selector matched within which an event
+ * was fired. If this Event was not associated with any Event delegation,
+ * accessing this value will throw an [UnsupportedError].
+ */
+ Element get matchingTarget {
+ if (_selector == null) {
+ throw new UnsupportedError('Cannot call matchingTarget if this Event did'
+ ' not arise as a result of event delegation.');
+ }
+ var currentTarget = this.currentTarget;
+ var target = this.target;
+ var matchedTarget;
+ do {
+ if (target.matches(_selector)) return target;
+ target = target.parent;
+ } while (target != null && target != currentTarget.parent);
+ throw new StateError('No selector matched for populating matchedTarget.');
+ }
+
+ /**
+ * This event's path, taking into account shadow DOM.
+ *
+ * ## Other resources
+ *
+ * * [Shadow DOM extensions to Event]
+ * (http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event) from
+ * W3C.
+ */
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event
+ @Experimental()
+ List<Node> get path => wrapped.path;
+
+ dynamic get _get_currentTarget => wrapped._get_currentTarget;
+
+ dynamic get _get_target => wrapped._get_target;
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -35318,6 +35353,17 @@
return new _DOMWindowCrossFrame(w);
}
}
+
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ Events get on => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ void addEventListener(String type, EventListener listener, [bool useCapture])
+ => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ bool dispatchEvent(Event event) => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ void removeEventListener(String type, EventListener listener,
+ [bool useCapture]) => throw new UnimplementedError();
}
class _LocationCrossFrame implements LocationBase {
@@ -35580,6 +35626,17 @@
throw new UnsupportedError(
"Cannot initialize a KeyboardEvent from a KeyEvent.");
}
+ int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
+ @Experimental() // untriaged
+ bool getModifierState(String keyArgument) => throw new UnimplementedError();
+ @Experimental() // untriaged
+ int get location => throw new UnimplementedError();
+ @Experimental() // untriaged
+ bool get repeat => throw new UnimplementedError();
+ dynamic get _get_view => throw new UnimplementedError();
}
// 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
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index dd2ad02..60c8271 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -101,7 +101,7 @@
@DocsEditable()
@DomName('AbstractWorker')
-class AbstractWorker extends NativeFieldWrapperClass2 implements EventTarget {
+abstract class AbstractWorker extends NativeFieldWrapperClass2 implements EventTarget {
// To suppress missing implicit constructor warnings.
factory AbstractWorker._() { throw new UnsupportedError("Not supported"); }
@@ -304,6 +304,12 @@
@DocsEditable()
void set href(String value) native "HTMLAnchorElement_href_Setter";
+ @DomName('HTMLAnchorElement.origin')
+ @DocsEditable()
+ // WebKit only
+ @Experimental() // non-standard
+ String get origin native "HTMLAnchorElement_origin_Getter";
+
@DomName('HTMLAnchorElement.password')
@DocsEditable()
@Experimental() // untriaged
@@ -8291,13 +8297,16 @@
validator: validator, treeSanitizer: treeSanitizer);
}
- List<Element> _children;
+ HtmlCollection get _children => throw new UnimplementedError(
+ 'Use _docChildren instead');
+
+ List<Element> _docChildren;
List<Element> get children {
- if (_children == null) {
- _children = new FilteredElementList(this);
+ if (_docChildren == null) {
+ _docChildren = new FilteredElementList(this);
}
- return _children;
+ return _docChildren;
}
void set children(List<Element> value) {
@@ -8424,22 +8433,6 @@
@DocsEditable()
-@DomName('DocumentType')
-// http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-412266927
-@deprecated // stable
-class DocumentType extends Node implements ChildNode {
- // To suppress missing implicit constructor warnings.
- factory DocumentType._() { throw new UnsupportedError("Not supported"); }
-
-}
-// 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.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable()
@DomName('DOMError')
class DomError extends NativeFieldWrapperClass2 {
// To suppress missing implicit constructor warnings.
@@ -8522,11 +8515,11 @@
@DomName('DOMImplementation.createDocument')
@DocsEditable()
- Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) native "DOMImplementation_createDocument_Callback";
+ Document createDocument(String namespaceURI, String qualifiedName, _DocumentType doctype) native "DOMImplementation_createDocument_Callback";
@DomName('DOMImplementation.createDocumentType')
@DocsEditable()
- DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) native "DOMImplementation_createDocumentType_Callback";
+ _DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) native "DOMImplementation_createDocumentType_Callback";
@DomName('DOMImplementation.createHTMLDocument')
@DocsEditable()
@@ -11186,8 +11179,6 @@
bool hidden;
- InputMethodContext get inputMethodContext;
-
bool get isContentEditable;
String lang;
@@ -15596,10 +15587,6 @@
// To suppress missing implicit constructor warnings.
factory HtmlFormControlsCollection._() { throw new UnsupportedError("Not supported"); }
- @DomName('HTMLFormControlsCollection.__getter__')
- @DocsEditable()
- Node __getter__(int index) native "HTMLFormControlsCollection___getter___Callback";
-
@DomName('HTMLFormControlsCollection.namedItem')
@DocsEditable()
Node namedItem(String name) native "HTMLFormControlsCollection_namedItem_Callback";
@@ -31603,6 +31590,15 @@
String getEventType(EventTarget target) {
return _eventType;
}
+
+ ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, 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
@@ -31641,11 +31637,6 @@
// To suppress missing implicit constructor warnings.
factory WindowEventHandlers._() { throw new UnsupportedError("Not supported"); }
- @DomName('WindowEventHandlers.beforeunloadEvent')
- @DocsEditable()
- @Experimental() // untriaged
- static const EventStreamProvider<Event> beforeUnloadEvent = const EventStreamProvider<Event>('beforeunload');
-
@DomName('WindowEventHandlers.hashchangeEvent')
@DocsEditable()
@Experimental() // untriaged
@@ -31686,11 +31677,6 @@
@Experimental() // untriaged
static const EventStreamProvider<Event> unloadEvent = const EventStreamProvider<Event>('unload');
- @DomName('WindowEventHandlers.onbeforeunload')
- @DocsEditable()
- @Experimental() // untriaged
- Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);
-
@DomName('WindowEventHandlers.onhashchange')
@DocsEditable()
@Experimental() // untriaged
@@ -32865,6 +32851,22 @@
@DocsEditable()
+@DomName('DocumentType')
+// http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-412266927
+@deprecated // stable
+abstract class _DocumentType extends Node implements ChildNode {
+ // To suppress missing implicit constructor warnings.
+ factory _DocumentType._() { throw new UnsupportedError("Not supported"); }
+
+}
+// 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.
+
+// WARNING: Do not edit - generated code.
+
+
+@DocsEditable()
@DomName('WebKitPoint')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@@ -33920,6 +33922,10 @@
*/
class _WrappedEvent implements Event {
final Event wrapped;
+
+ /** The CSS selector involved with event delegation. */
+ String _selector;
+
_WrappedEvent(this.wrapped);
bool get bubbles => wrapped.bubbles;
@@ -33957,6 +33963,43 @@
void stopPropagation() {
wrapped.stopPropagation();
}
+
+ /**
+ * A pointer to the element whose CSS selector matched within which an event
+ * was fired. If this Event was not associated with any Event delegation,
+ * accessing this value will throw an [UnsupportedError].
+ */
+ Element get matchingTarget {
+ if (_selector == null) {
+ throw new UnsupportedError('Cannot call matchingTarget if this Event did'
+ ' not arise as a result of event delegation.');
+ }
+ var currentTarget = this.currentTarget;
+ var target = this.target;
+ var matchedTarget;
+ do {
+ if (target.matches(_selector)) return target;
+ target = target.parent;
+ } while (target != null && target != currentTarget.parent);
+ throw new StateError('No selector matched for populating matchedTarget.');
+ }
+
+ /**
+ * This event's path, taking into account shadow DOM.
+ *
+ * ## Other resources
+ *
+ * * [Shadow DOM extensions to Event]
+ * (http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event) from
+ * W3C.
+ */
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event
+ @Experimental()
+ List<Node> get path => wrapped.path;
+
+ dynamic get _get_currentTarget => wrapped._get_currentTarget;
+
+ dynamic get _get_target => wrapped._get_target;
}
// 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
@@ -35363,6 +35406,9 @@
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
+
+ String get _eventType =>
+ throw new UnsupportedError('Access type through getEventType method.');
}
// DO NOT EDIT- this file is generated from running tool/generator.sh.
@@ -38088,6 +38134,17 @@
throw new UnsupportedError(
"Cannot initialize a KeyboardEvent from a KeyEvent.");
}
+ int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
+ @Experimental() // untriaged
+ bool getModifierState(String keyArgument) => throw new UnimplementedError();
+ @Experimental() // untriaged
+ int get location => throw new UnimplementedError();
+ @Experimental() // untriaged
+ bool get repeat => throw new UnimplementedError();
+ dynamic get _get_view => throw new UnimplementedError();
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -38585,7 +38642,7 @@
// TODO(vsm): Move these checks into native code.
ClassMirror cls = reflectClass(type);
if (_isBuiltinType(cls)) {
- throw new UnsupportedError("Invalid custom element from ${cls.owner.uri}.");
+ throw new UnsupportedError("Invalid custom element from ${(cls.owner as LibraryMirror).uri}.");
}
var className = MirrorSystem.getName(cls.simpleName);
var createdConstructor = cls.declarations[new Symbol('$className.created')];
diff --git a/sdk/lib/html/html_common/lists.dart b/sdk/lib/html/html_common/lists.dart
index 5c230a9..f33d64a 100644
--- a/sdk/lib/html/html_common/lists.dart
+++ b/sdk/lib/html/html_common/lists.dart
@@ -70,6 +70,6 @@
/**
* For accessing underlying node lists, for dart:js interop.
*/
-class NodeListWrapper {
+abstract class NodeListWrapper {
List<Node> get rawList;
}
diff --git a/tests/compiler/dart2js/analyze_api_test.dart b/tests/compiler/dart2js/analyze_api_test.dart
index 2e860d5..de48a2e 100644
--- a/tests/compiler/dart2js/analyze_api_test.dart
+++ b/tests/compiler/dart2js/analyze_api_test.dart
@@ -20,14 +20,6 @@
// TODO(johnniwinther): Support canonical URIs as keys and message kinds as
// values.
const Map<String, List<String>> WHITE_LIST = const {
- 'html_dart2js.dart': const [
- "doesn't implement", // Issue 16105.
- "is not assignable to the type 'HtmlCollection'", // Issue 16105.
- "is not a subtype of the overridden method type", // Issue 16105.
- ],
- 'html_common/lists.dart': const [
- "has no implementation" // Issue 16105.
- ],
};
void main() {
diff --git a/tools/VERSION b/tools/VERSION
index 7b73e2c..0ff063f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 2
PATCH 0
PRERELEASE 5
-PRERELEASE_PATCH 6
+PRERELEASE_PATCH 7
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index e9576fa..69e9804 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -2098,11 +2098,17 @@
"support_level": "deprecated"
},
"name": {},
+ "nextElementSibling": {
+ "support_level": "untriaged"
+ },
"notations": {
"comment": "http://dom.spec.whatwg.org/#dom-documenttype-notations",
"dart_action": "suppress",
"support_level": "deprecated"
},
+ "previousElementSibling": {
+ "support_level": "untriaged"
+ },
"publicId": {},
"remove": {
"support_level": "nonstandard"
@@ -2241,6 +2247,8 @@
"support_level": "nonstandard"
},
"inputMethodContext": {
+ "comment": "http://www.w3.org/TR/ime-api/#the-inputmethodcontext-property Per the spec is only on HTMLElement.",
+ "dart_action": "suppress",
"support_level": "untriaged"
},
"insertAdjacentElement": {
@@ -3380,7 +3388,6 @@
},
"origin": {
"comment": "WebKit only",
- "dart_action": "suppress",
"support_level": "nonstandard"
},
"password": {
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index be8372a..b450d61 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -78,6 +78,7 @@
'DataView', # Typed arrays
'DirectoryEntrySync', # Workers
'DirectoryReaderSync', # Workers
+ 'DocumentType',
'EntrySync', # Workers
'FileEntrySync', # Workers
'FileReaderSync', # Workers
@@ -627,6 +628,7 @@
'HTMLDirectoryElement.*',
'HTMLDivElement.align',
'HTMLFontElement.*',
+ 'HTMLFormControlsCollection.__getter__',
'HTMLFormElement.get:elements',
'HTMLFrameElement.*',
'HTMLFrameSetElement.*',
@@ -753,6 +755,7 @@
'SVGElementInstance.on:wheel',
'WheelEvent.wheelDelta',
'Window.on:wheel',
+ 'WindowEventHandlers.on:beforeUnload',
'WorkerGlobalScope.webkitIndexedDB',
# TODO(jacobr): should these be removed?
'Document.close',
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 85b4d78..ea66285 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -428,4 +428,7 @@
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
+
+ String get _eventType =>
+ throw new UnsupportedError('Access type through getEventType method.');
}
diff --git a/tools/dom/src/WrappedEvent.dart b/tools/dom/src/WrappedEvent.dart
index af64fae..4f30af9 100644
--- a/tools/dom/src/WrappedEvent.dart
+++ b/tools/dom/src/WrappedEvent.dart
@@ -9,6 +9,10 @@
*/
class _WrappedEvent implements Event {
final Event wrapped;
+
+ /** The CSS selector involved with event delegation. */
+ String _selector;
+
_WrappedEvent(this.wrapped);
bool get bubbles => wrapped.bubbles;
@@ -46,4 +50,41 @@
void stopPropagation() {
wrapped.stopPropagation();
}
+
+ /**
+ * A pointer to the element whose CSS selector matched within which an event
+ * was fired. If this Event was not associated with any Event delegation,
+ * accessing this value will throw an [UnsupportedError].
+ */
+ Element get matchingTarget {
+ if (_selector == null) {
+ throw new UnsupportedError('Cannot call matchingTarget if this Event did'
+ ' not arise as a result of event delegation.');
+ }
+ var currentTarget = this.currentTarget;
+ var target = this.target;
+ var matchedTarget;
+ do {
+ if (target.matches(_selector)) return target;
+ target = target.parent;
+ } while (target != null && target != currentTarget.parent);
+ throw new StateError('No selector matched for populating matchedTarget.');
+ }
+
+ /**
+ * This event's path, taking into account shadow DOM.
+ *
+ * ## Other resources
+ *
+ * * [Shadow DOM extensions to Event]
+ * (http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event) from
+ * W3C.
+ */
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event
+ @Experimental()
+ List<Node> get path => wrapped.path;
+
+ dynamic get _get_currentTarget => wrapped._get_currentTarget;
+
+ dynamic get _get_target => wrapped._get_target;
}
diff --git a/tools/dom/src/dart2js_DOMImplementation.dart b/tools/dom/src/dart2js_DOMImplementation.dart
index 051df51..78a54b3 100644
--- a/tools/dom/src/dart2js_DOMImplementation.dart
+++ b/tools/dom/src/dart2js_DOMImplementation.dart
@@ -49,6 +49,17 @@
return new _DOMWindowCrossFrame(w);
}
}
+
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ Events get on => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ void addEventListener(String type, EventListener listener, [bool useCapture])
+ => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ bool dispatchEvent(Event event) => throw new UnimplementedError();
+ // TODO(efortuna): Remove this method. dartbug.com/16814
+ void removeEventListener(String type, EventListener listener,
+ [bool useCapture]) => throw new UnimplementedError();
}
class _LocationCrossFrame implements LocationBase {
diff --git a/tools/dom/src/dart2js_KeyEvent.dart b/tools/dom/src/dart2js_KeyEvent.dart
index 8c7b5fd..f3be576 100644
--- a/tools/dom/src/dart2js_KeyEvent.dart
+++ b/tools/dom/src/dart2js_KeyEvent.dart
@@ -210,4 +210,15 @@
throw new UnsupportedError(
"Cannot initialize a KeyboardEvent from a KeyEvent.");
}
+ int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
+ @Experimental() // untriaged
+ bool getModifierState(String keyArgument) => throw new UnimplementedError();
+ @Experimental() // untriaged
+ int get location => throw new UnimplementedError();
+ @Experimental() // untriaged
+ bool get repeat => throw new UnimplementedError();
+ dynamic get _get_view => throw new UnimplementedError();
}
diff --git a/tools/dom/src/dartium_KeyEvent.dart b/tools/dom/src/dartium_KeyEvent.dart
index 830da2f..d3716b3 100644
--- a/tools/dom/src/dartium_KeyEvent.dart
+++ b/tools/dom/src/dartium_KeyEvent.dart
@@ -129,4 +129,15 @@
throw new UnsupportedError(
"Cannot initialize a KeyboardEvent from a KeyEvent.");
}
+ int get _layerX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _layerY => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent');
+ int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent');
+ @Experimental() // untriaged
+ bool getModifierState(String keyArgument) => throw new UnimplementedError();
+ @Experimental() // untriaged
+ int get location => throw new UnimplementedError();
+ @Experimental() // untriaged
+ bool get repeat => throw new UnimplementedError();
+ dynamic get _get_view => throw new UnimplementedError();
}
diff --git a/tools/dom/src/native_DOMImplementation.dart b/tools/dom/src/native_DOMImplementation.dart
index d7a3fe6..d84e396 100644
--- a/tools/dom/src/native_DOMImplementation.dart
+++ b/tools/dom/src/native_DOMImplementation.dart
@@ -406,7 +406,7 @@
// TODO(vsm): Move these checks into native code.
ClassMirror cls = reflectClass(type);
if (_isBuiltinType(cls)) {
- throw new UnsupportedError("Invalid custom element from ${cls.owner.uri}.");
+ throw new UnsupportedError("Invalid custom element from ${(cls.owner as LibraryMirror).uri}.");
}
var className = MirrorSystem.getName(cls.simpleName);
var createdConstructor = cls.declarations[new Symbol('$className.created')];
diff --git a/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate b/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate
index 2349ce5..e23390d 100644
--- a/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate
+++ b/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate
@@ -5,5 +5,5 @@
part of $LIBRARYNAME;
@DocsEditable()
-$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS implements EventTarget$NATIVESPEC {
+$(ANNOTATIONS)$(CLASS_MODIFIERS)abstract class $CLASSNAME$EXTENDS$MIXINS implements EventTarget$NATIVESPEC {
$!MEMBERS}
diff --git a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
index e57d98f..86db4ea 100644
--- a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
@@ -21,18 +21,21 @@
validator: validator, treeSanitizer: treeSanitizer);
}
+ HtmlCollection get _children => throw new UnimplementedError(
+ 'Use _docChildren instead');
+
$if DART2JS
// Native field is used only by Dart code so does not lead to instantiation
// of native classes
@Creates('Null')
$endif
- List<Element> _children;
+ List<Element> _docChildren;
List<Element> get children {
- if (_children == null) {
- _children = new FilteredElementList(this);
+ if (_docChildren == null) {
+ _docChildren = new FilteredElementList(this);
}
- return _children;
+ return _docChildren;
}
void set children(List<Element> value) {
diff --git a/tools/dom/templates/html/impl/impl_Window.darttemplate b/tools/dom/templates/html/impl/impl_Window.darttemplate
index b84bb5f..cdf44bf 100644
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate
@@ -394,4 +394,13 @@
String getEventType(EventTarget target) {
return _eventType;
}
+
+ ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, useCapture);
+ }
}