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

Side by Side Diff: pkg/third_party/html5lib/lib/dom.dart

Issue 157983005: pkg/third_party/html5lib: lots of cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: bump version Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * A simple tree API that results from parsing html. Intended to be compatible 2 * A simple tree API that results from parsing html. Intended to be compatible
3 * with dart:html, but right now it resembles the classic JS DOM. 3 * with dart:html, but right now it resembles the classic JS DOM.
4 */ 4 */
5 library dom; 5 library dom;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'package:source_maps/span.dart' show FileSpan; 8 import 'package:source_maps/span.dart' show FileSpan;
9 9
10 import 'src/constants.dart'; 10 import 'src/constants.dart';
11 import 'src/list_proxy.dart'; 11 import 'src/list_proxy.dart';
12 import 'src/token.dart'; 12 import 'src/token.dart';
13 import 'src/tokenizer.dart'; 13 import 'src/tokenizer.dart';
14 import 'src/treebuilder.dart';
15 import 'src/utils.dart'; 14 import 'src/utils.dart';
16 import 'dom_parsing.dart'; 15 import 'dom_parsing.dart';
17 import 'parser.dart'; 16 import 'parser.dart';
18 17
19 // TODO(jmesserly): this needs to be replaced by an AttributeMap for attributes 18 // TODO(jmesserly): this needs to be replaced by an AttributeMap for attributes
20 // that exposes namespace info. 19 // that exposes namespace info.
21 class AttributeName implements Comparable { 20 class AttributeName implements Comparable {
22 /** The namespace prefix, e.g. `xlink`. */ 21 /** The namespace prefix, e.g. `xlink`. */
23 final String prefix; 22 final String prefix;
24 23
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 String value; 420 String value;
422 421
423 Text(this.value) : super(null); 422 Text(this.value) : super(null);
424 423
425 int get nodeType => Node.TEXT_NODE; 424 int get nodeType => Node.TEXT_NODE;
426 425
427 String toString() => '"$value"'; 426 String toString() => '"$value"';
428 427
429 void _addOuterHtml(StringBuffer str) { 428 void _addOuterHtml(StringBuffer str) {
430 // Don't escape text for certain elements, notably <script>. 429 // Don't escape text for certain elements, notably <script>.
431 if (rcdataElements.contains(parent.tagName) || 430 if (RCDATA_ELEMENTS.contains(parent.tagName) ||
432 parent.tagName == 'plaintext') { 431 parent.tagName == 'plaintext') {
433 str.write(value); 432 str.write(value);
434 } else { 433 } else {
435 str.write(htmlSerializeEscape(value)); 434 str.write(htmlSerializeEscape(value));
436 } 435 }
437 } 436 }
438 437
439 Text clone() => new Text(value); 438 Text clone() => new Text(value);
440 } 439 }
441 440
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (start == null) start = length - 1; 863 if (start == null) start = length - 1;
865 return _filtered.lastIndexOf(element, start); 864 return _filtered.lastIndexOf(element, start);
866 } 865 }
867 866
868 Element get first => _filtered.first; 867 Element get first => _filtered.first;
869 868
870 Element get last => _filtered.last; 869 Element get last => _filtered.last;
871 870
872 Element get single => _filtered.single; 871 Element get single => _filtered.single;
873 } 872 }
OLDNEW
« no previous file with comments | « no previous file | pkg/third_party/html5lib/lib/dom_parsing.dart » ('j') | pkg/third_party/html5lib/lib/src/constants.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698