| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 final Location _loc = window.location; | 104 final Location _loc = window.location; |
| 105 | 105 |
| 106 bool allowsUri(String uri) { | 106 bool allowsUri(String uri) { |
| 107 _hiddenAnchor.href = uri; | 107 _hiddenAnchor.href = uri; |
| 108 // IE leaves an empty hostname for same-origin URIs. | 108 // IE leaves an empty hostname for same-origin URIs. |
| 109 return (_hiddenAnchor.hostname == _loc.hostname && | 109 return (_hiddenAnchor.hostname == _loc.hostname && |
| 110 _hiddenAnchor.port == _loc.port && | 110 _hiddenAnchor.port == _loc.port && |
| 111 _hiddenAnchor.protocol == _loc.protocol) || | 111 _hiddenAnchor.protocol == _loc.protocol) || |
| 112 (_hiddenAnchor.hostname == '' && | 112 (_hiddenAnchor.hostname == '' && |
| 113 _hiddenAnchor.port == '' && | 113 _hiddenAnchor.port == '' && |
| 114 _hiddenAnchor.protocol == ':'); | 114 (_hiddenAnchor.protocol == ':' || _hiddenAnchor.protocol == '')); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 class _ThrowsNodeValidator implements NodeValidator { | 119 class _ThrowsNodeValidator implements NodeValidator { |
| 120 final NodeValidator validator; | 120 final NodeValidator validator; |
| 121 | 121 |
| 122 _ThrowsNodeValidator(this.validator) {} | 122 _ThrowsNodeValidator(this.validator) {} |
| 123 | 123 |
| 124 bool allowsElement(Element element) { | 124 bool allowsElement(Element element) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 case Node.COMMENT_NODE: | 202 case Node.COMMENT_NODE: |
| 203 case Node.DOCUMENT_FRAGMENT_NODE: | 203 case Node.DOCUMENT_FRAGMENT_NODE: |
| 204 case Node.TEXT_NODE: | 204 case Node.TEXT_NODE: |
| 205 case Node.CDATA_SECTION_NODE: | 205 case Node.CDATA_SECTION_NODE: |
| 206 break; | 206 break; |
| 207 default: | 207 default: |
| 208 node.remove(); | 208 node.remove(); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| OLD | NEW |