| 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'; | |
| 8 import 'package:utf/utf.dart' show codepointsToString; | |
| 9 import 'dom.dart'; | 7 import 'dom.dart'; |
| 10 | 8 |
| 11 /** A simple tree visitor for the DOM nodes. */ | 9 /** A simple tree visitor for the DOM nodes. */ |
| 12 class TreeVisitor { | 10 class TreeVisitor { |
| 13 visit(Node node) { | 11 visit(Node node) { |
| 14 switch (node.nodeType) { | 12 switch (node.nodeType) { |
| 15 case Node.ELEMENT_NODE: return visitElement(node); | 13 case Node.ELEMENT_NODE: return visitElement(node); |
| 16 case Node.TEXT_NODE: return visitText(node); | 14 case Node.TEXT_NODE: return visitText(node); |
| 17 case Node.COMMENT_NODE: return visitComment(node); | 15 case Node.COMMENT_NODE: return visitComment(node); |
| 18 case Node.DOCUMENT_FRAGMENT_NODE: return visitDocumentFragment(node); | 16 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) { | 165 bool isVoidElement(String tagName) { |
| 168 switch (tagName) { | 166 switch (tagName) { |
| 169 case "area": case "base": case "br": case "col": case "command": | 167 case "area": case "base": case "br": case "col": case "command": |
| 170 case "embed": case "hr": case "img": case "input": case "keygen": | 168 case "embed": case "hr": case "img": case "input": case "keygen": |
| 171 case "link": case "meta": case "param": case "source": case "track": | 169 case "link": case "meta": case "param": case "source": case "track": |
| 172 case "wbr": | 170 case "wbr": |
| 173 return true; | 171 return true; |
| 174 } | 172 } |
| 175 return false; | 173 return false; |
| 176 } | 174 } |
| OLD | NEW |