OLD | NEW |
1 // DO NOT EDIT- this file is generated from running tool/generator.sh. | 1 // DO NOT EDIT- this file is generated from running tool/generator.sh. |
2 | 2 |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 // for details. All rights reserved. Use of this source code is governed by a | 4 // for details. All rights reserved. Use of this source code is governed by a |
5 // BSD-style license that can be found in the LICENSE file. | 5 // BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 part of dart.dom.html; | 7 part of dart.dom.html; |
8 | 8 |
9 /** | 9 /** |
10 * A Dart DOM validator generated from Caja whitelists. | 10 * A Dart DOM validator generated from Caja whitelists. |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 _attributeValidators[attr] = _standardAttributeValidator; | 416 _attributeValidators[attr] = _standardAttributeValidator; |
417 } | 417 } |
418 | 418 |
419 for (var attr in _uriAttributes) { | 419 for (var attr in _uriAttributes) { |
420 _attributeValidators[attr] = _uriAttributeValidator; | 420 _attributeValidators[attr] = _uriAttributeValidator; |
421 } | 421 } |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 bool allowsElement(Element element) { | 425 bool allowsElement(Element element) { |
426 return _allowedElements.contains(element.tagName); | 426 return _allowedElements.contains(element._safeTagName); |
427 } | 427 } |
428 | 428 |
429 bool allowsAttribute(Element element, String attributeName, String value) { | 429 bool allowsAttribute(Element element, String attributeName, String value) { |
430 var tagName = element.tagName; | 430 var tagName = element._safeTagName; |
431 var validator = _attributeValidators['$tagName::$attributeName']; | 431 var validator = _attributeValidators['$tagName::$attributeName']; |
432 if (validator == null) { | 432 if (validator == null) { |
433 validator = _attributeValidators['*::$attributeName']; | 433 validator = _attributeValidators['*::$attributeName']; |
434 } | 434 } |
435 if (validator == null) { | 435 if (validator == null) { |
436 return false; | 436 return false; |
437 } | 437 } |
438 return validator(element, attributeName, value, this); | 438 return validator(element, attributeName, value, this); |
439 } | 439 } |
440 | 440 |
441 static bool _standardAttributeValidator(Element element, String attributeName, | 441 static bool _standardAttributeValidator(Element element, String attributeName, |
442 String value, _Html5NodeValidator context) { | 442 String value, _Html5NodeValidator context) { |
443 return true; | 443 return true; |
444 } | 444 } |
445 | 445 |
446 static bool _uriAttributeValidator(Element element, String attributeName, | 446 static bool _uriAttributeValidator(Element element, String attributeName, |
447 String value, _Html5NodeValidator context) { | 447 String value, _Html5NodeValidator context) { |
448 return context.uriPolicy.allowsUri(value); | 448 return context.uriPolicy.allowsUri(value); |
449 } | 449 } |
450 } | 450 } |
OLD | NEW |