OLD | NEW |
1 /** | 1 /** |
2 * This library contains extra APIs that aren't in the DOM, but are useful | 2 * This library contains extra APIs that aren't in the DOM, but are useful |
3 * when interacting with the parse tree. | 3 * when interacting with the parse tree. |
4 */ | 4 */ |
5 library dom_parsing; | 5 library dom_parsing; |
6 | 6 |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 import 'dart:utf' show codepointsToString; | 8 import 'package:utf/utf.dart' show codepointsToString; |
9 import 'dom.dart'; | 9 import 'dom.dart'; |
10 | 10 |
11 /** A simple tree visitor for the DOM nodes. */ | 11 /** A simple tree visitor for the DOM nodes. */ |
12 class TreeVisitor { | 12 class TreeVisitor { |
13 visit(Node node) { | 13 visit(Node node) { |
14 switch (node.nodeType) { | 14 switch (node.nodeType) { |
15 case Node.ELEMENT_NODE: return visitElement(node); | 15 case Node.ELEMENT_NODE: return visitElement(node); |
16 case Node.TEXT_NODE: return visitText(node); | 16 case Node.TEXT_NODE: return visitText(node); |
17 case Node.COMMENT_NODE: return visitComment(node); | 17 case Node.COMMENT_NODE: return visitComment(node); |
18 case Node.DOCUMENT_FRAGMENT_NODE: return visitDocumentFragment(node); | 18 case Node.DOCUMENT_FRAGMENT_NODE: return visitDocumentFragment(node); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 bool isVoidElement(String tagName) { | 167 bool isVoidElement(String tagName) { |
168 switch (tagName) { | 168 switch (tagName) { |
169 case "area": case "base": case "br": case "col": case "command": | 169 case "area": case "base": case "br": case "col": case "command": |
170 case "embed": case "hr": case "img": case "input": case "keygen": | 170 case "embed": case "hr": case "img": case "input": case "keygen": |
171 case "link": case "meta": case "param": case "source": case "track": | 171 case "link": case "meta": case "param": case "source": case "track": |
172 case "wbr": | 172 case "wbr": |
173 return true; | 173 return true; |
174 } | 174 } |
175 return false; | 175 return false; |
176 } | 176 } |
OLD | NEW |