Index: tools/dom/templates/html/impl/impl_Element.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate |
index a2ea4fa5a45d8f68655e5b9cdac8f28e036ea924..806dae6be1a52ba5a7c62cbc44462acbcb48bc65 100644 |
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate |
@@ -264,8 +264,8 @@ $!STREAM_GETTER_SIGNATURES |
// declared to return `ElementList`. This provides all the static analysis |
// benefit so there is no need for this class have a constrained type parameter. |
// |
-class _FrozenElementList extends ListBase<Element> |
- implements ElementList<Element>, NodeListWrapper { |
+class _FrozenElementList<E extends Element> extends ListBase<E> |
+ implements ElementList<E>, NodeListWrapper { |
final List<Node> _nodeList; |
$if JSINTEROP |
@@ -280,9 +280,9 @@ $endif |
int get length => _nodeList.length; |
- Element operator [](int index) => _nodeList[index]; |
+ E operator [](int index) => _nodeList[index] as E; |
sra1
2016/04/21 22:43:15
E _asE(Node node) {
E element = node;
return e
|
- void operator []=(int index, Element value) { |
+ void operator []=(int index, E value) { |
throw new UnsupportedError('Cannot modify list'); |
} |
@@ -290,7 +290,7 @@ $endif |
throw new UnsupportedError('Cannot modify list'); |
} |
- void sort([Comparator<Element> compare]) { |
+ void sort([Comparator<E> compare]) { |
throw new UnsupportedError('Cannot sort list'); |
} |
@@ -298,11 +298,11 @@ $endif |
throw new UnsupportedError('Cannot shuffle list'); |
} |
- Element get first => _nodeList.first; |
+ E get first => _nodeList.first as E; |
sra1
2016/04/21 22:43:15
=> _asE(_nodeList.first);
|
- Element get last => _nodeList.last; |
+ E get last => _nodeList.last as E; |
- Element get single => _nodeList.single; |
+ E get single => _nodeList.single as E; |
CssClassSet get classes => new _MultiElementCssClassSet(this); |
@@ -611,8 +611,8 @@ $endif |
* [CSS selector specification](http://www.w3.org/TR/css3-selectors/). |
*/ |
@DomName('Element.querySelectorAll') |
- ElementList<Element> querySelectorAll(String selectors) => |
- new _FrozenElementList._wrap(_querySelectorAll(selectors)); |
+ ElementList<Element /*=T*/> querySelectorAll/*<T extends Element>*/(String selectors) => |
+ new _FrozenElementList/*<T>*/._wrap(_querySelectorAll(selectors)); |
/** |
* Alias for [querySelector]. Note this function is deprecated because its |
@@ -630,7 +630,7 @@ $endif |
@deprecated |
@DomName('Element.querySelectorAll') |
@Experimental() |
- ElementList<Element> queryAll(String relativeSelectors) => |
+ ElementList<Element /*=T*/> queryAll/*<T extends Element>*/(String relativeSelectors) => |
querySelectorAll(relativeSelectors); |
/** |