OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.dom.html; | 5 part of dart.dom.html; |
6 | 6 |
7 | 7 |
8 /** | 8 /** |
9 * Interface used to validate that only accepted elements and attributes are | 9 * Interface used to validate that only accepted elements and attributes are |
10 * allowed while parsing HTML strings into DOM nodes. | 10 * allowed while parsing HTML strings into DOM nodes. |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (element is TemplateElement) { | 246 if (element is TemplateElement) { |
247 TemplateElement template = element; | 247 TemplateElement template = element; |
248 sanitizeTree(template.content); | 248 sanitizeTree(template.content); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 /// Sanitize the node and its children recursively. | 252 /// Sanitize the node and its children recursively. |
253 void sanitizeNode(Node node, Node parent) { | 253 void sanitizeNode(Node node, Node parent) { |
254 switch (node.nodeType) { | 254 switch (node.nodeType) { |
255 case Node.ELEMENT_NODE: | 255 case Node.ELEMENT_NODE: |
256 _sanitizeUntrustedElement(node, parent); | 256 _sanitizeUntrustedElement(node, parent); |
257 break; | 257 break; |
258 case Node.COMMENT_NODE: | 258 case Node.COMMENT_NODE: |
259 case Node.DOCUMENT_FRAGMENT_NODE: | 259 case Node.DOCUMENT_FRAGMENT_NODE: |
260 case Node.TEXT_NODE: | 260 case Node.TEXT_NODE: |
261 case Node.CDATA_SECTION_NODE: | 261 case Node.CDATA_SECTION_NODE: |
262 break; | 262 break; |
263 default: | 263 default: |
264 _removeNode(node, parent); | 264 _removeNode(node, parent); |
265 } | 265 } |
266 } | 266 } |
267 } | 267 } |
OLD | NEW |