| Index: lib/dom.dart
|
| diff --git a/lib/dom.dart b/lib/dom.dart
|
| index bd3e2bdb5dbcf5717860e918dd912c1789834acc..a50048130ee0790442da26c241643dced11ac6a0 100644
|
| --- a/lib/dom.dart
|
| +++ b/lib/dom.dart
|
| @@ -8,16 +8,17 @@ library dom;
|
| // implement that.
|
|
|
| import 'dart:collection';
|
| +
|
| import 'package:source_span/source_span.dart';
|
|
|
| +import 'dom_parsing.dart';
|
| +import 'parser.dart';
|
| import 'src/constants.dart';
|
| import 'src/css_class_set.dart';
|
| import 'src/list_proxy.dart';
|
| import 'src/query_selector.dart' as query;
|
| import 'src/token.dart';
|
| import 'src/tokenizer.dart';
|
| -import 'dom_parsing.dart';
|
| -import 'parser.dart';
|
|
|
| export 'src/css_class_set.dart' show CssClassSet;
|
|
|
| @@ -110,8 +111,8 @@ abstract class _ElementAndDocument implements _ParentNode {
|
| List<Element> getElementsByTagName(String localName) =>
|
| querySelectorAll(localName);
|
|
|
| - List<Element> getElementsByClassName(String classNames) => querySelectorAll(
|
| - classNames.splitMapJoin(' ',
|
| + List<Element> getElementsByClassName(String classNames) =>
|
| + querySelectorAll(classNames.splitMapJoin(' ',
|
| onNonMatch: (m) => m.isNotEmpty ? '.$m' : m, onMatch: (m) => ''));
|
| }
|
|
|
| @@ -292,8 +293,8 @@ abstract class Node {
|
| _attributeSpans[attr.name] =
|
| sourceSpan.file.span(offset + attr.start, offset + attr.end);
|
| if (attr.startValue != null) {
|
| - _attributeValueSpans[attr.name] = sourceSpan.file.span(
|
| - offset + attr.startValue, offset + attr.endValue);
|
| + _attributeValueSpans[attr.name] = sourceSpan.file
|
| + .span(offset + attr.startValue, offset + attr.endValue);
|
| }
|
| }
|
| }
|
| @@ -407,7 +408,9 @@ class Text extends Node {
|
| /// It will flatten back to a String on read.
|
| var _data;
|
|
|
| - Text(String data) : _data = data != null ? data : '', super._();
|
| + Text(String data)
|
| + : _data = data != null ? data : '',
|
| + super._();
|
|
|
| int get nodeType => Node.TEXT_NODE;
|
|
|
| @@ -476,7 +479,6 @@ class Element extends Node with _ParentNode, _ElementAndDocument {
|
| // TODO(jmesserly): for our version we can do something smarter in the parser.
|
| // All we really need is to set the correct parse state.
|
| 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.
|
| @@ -807,7 +809,8 @@ class NodeList extends ListProxy<Node> {
|
| /// filtered so that only elements are in the collection.
|
| // TODO(jmesserly): this was copied from dart:html
|
| // TODO(jmesserly): "implements List<Element>" is a workaround for analyzer bug.
|
| -class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
|
| +class FilteredElementList extends IterableBase<Element>
|
| + with ListMixin<Element>
|
| implements List<Element> {
|
| final List<Node> _childNodes;
|
|
|
| @@ -817,9 +820,7 @@ class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
|
| ///
|
| /// var filteredElements = new FilteredElementList(query("#container"));
|
| /// // filteredElements is [a, b, c].
|
| - FilteredElementList(Node node)
|
| - : _childNodes = node.nodes;
|
| -
|
| + FilteredElementList(Node node) : _childNodes = node.nodes;
|
|
|
| // We can't memoize this, since it's possible that children will be messed
|
| // with externally to this class.
|
| @@ -901,10 +902,9 @@ class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
|
| return result;
|
| }
|
|
|
| - Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(Element element)) => _filtered.map(f);
|
| + Iterable<T> map<T>(T f(Element element)) => _filtered.map(f);
|
| Iterable<Element> where(bool f(Element element)) => _filtered.where(f);
|
| - Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(Element element)) =>
|
| - _filtered.expand(f);
|
| + Iterable<T> expand<T>(Iterable<T> f(Element element)) => _filtered.expand(f);
|
|
|
| void insert(int index, Element value) {
|
| _childNodes.insert(index, value);
|
| @@ -936,8 +936,7 @@ class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
|
| return _filtered.reduce(combine);
|
| }
|
|
|
| - dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
|
| - dynamic/*=T*/ combine(var/*=T*/ previousValue, Element element)) {
|
| + T fold<T>(T initialValue, T combine(T previousValue, Element element)) {
|
| return _filtered.fold(initialValue, combine);
|
| }
|
|
|
| @@ -971,8 +970,7 @@ class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
|
| _filtered.getRange(start, end);
|
| // TODO(sigmund): this should be typed Element, but we currently run into a
|
| // bug where ListMixin<E>.indexOf() expects Object as the argument.
|
| - int indexOf(element, [int start = 0]) =>
|
| - _filtered.indexOf(element, start);
|
| + int indexOf(element, [int start = 0]) => _filtered.indexOf(element, start);
|
|
|
| // TODO(sigmund): this should be typed Element, but we currently run into a
|
| // bug where ListMixin<E>.lastIndexOf() expects Object as the argument.
|
|
|