| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 element.remove(); | 175 element.remove(); |
| 176 break; | 176 break; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 // TODO(blois): Need to be able to get all attributes, irrespective of | 180 // TODO(blois): Need to be able to get all attributes, irrespective of |
| 181 // XMLNS. | 181 // XMLNS. |
| 182 var keys = attrs.keys.toList(); | 182 var keys = attrs.keys.toList(); |
| 183 for (var i = attrs.length - 1; i >= 0; --i) { | 183 for (var i = attrs.length - 1; i >= 0; --i) { |
| 184 var name = keys[i]; | 184 var name = keys[i]; |
| 185 if (!validator.allowsAttribute(element, name, attrs[name])) { | 185 if (!validator.allowsAttribute(element, name.toLowerCase(), |
| 186 attrs[name])) { |
| 186 attrs.remove(name); | 187 attrs.remove(name); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 | 190 |
| 190 if (element is TemplateElement) { | 191 if (element is TemplateElement) { |
| 191 TemplateElement template = element; | 192 TemplateElement template = element; |
| 192 sanitizeTree(template.content); | 193 sanitizeTree(template.content); |
| 193 } | 194 } |
| 194 break; | 195 break; |
| 195 case Node.COMMENT_NODE: | 196 case Node.COMMENT_NODE: |
| 196 case Node.DOCUMENT_FRAGMENT_NODE: | 197 case Node.DOCUMENT_FRAGMENT_NODE: |
| 197 case Node.TEXT_NODE: | 198 case Node.TEXT_NODE: |
| 198 case Node.CDATA_SECTION_NODE: | 199 case Node.CDATA_SECTION_NODE: |
| 199 break; | 200 break; |
| 200 default: | 201 default: |
| 201 node.remove(); | 202 node.remove(); |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 } | 205 } |
| OLD | NEW |