Index: sdk/lib/html/dart2js/html_dart2js.dart |
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart |
index 0f15bdc72da26e478431c5f3d4952544ce9a94b9..a63c557a404149fd8270d76bbb72cc7a437563ac 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -39469,17 +39469,17 @@ class NodeValidatorBuilder implements NodeValidator { |
} |
class _SimpleNodeValidator implements NodeValidator { |
- final Set<String> allowedElements; |
- final Set<String> allowedAttributes; |
- final Set<String> allowedUriAttributes; |
+ final Set<String> allowedElements = new Set<String>(); |
+ final Set<String> allowedAttributes = new Set<String>(); |
+ final Set<String> allowedUriAttributes = new Set<String>(); |
final UriPolicy uriPolicy; |
factory _SimpleNodeValidator.allowNavigation(UriPolicy uriPolicy) { |
return new _SimpleNodeValidator(uriPolicy, |
- allowedElements: [ |
+ allowedElements: const [ |
'A', |
'FORM'], |
- allowedAttributes: [ |
+ allowedAttributes: const [ |
'A::accesskey', |
'A::coords', |
'A::hreflang', |
@@ -39496,7 +39496,7 @@ class _SimpleNodeValidator implements NodeValidator { |
'FORM::novalidate', |
'FORM::target', |
], |
- allowedUriAttributes: [ |
+ allowedUriAttributes: const [ |
'A::href', |
'FORM::action', |
]); |
@@ -39504,10 +39504,10 @@ class _SimpleNodeValidator implements NodeValidator { |
factory _SimpleNodeValidator.allowImages(UriPolicy uriPolicy) { |
return new _SimpleNodeValidator(uriPolicy, |
- allowedElements: [ |
+ allowedElements: const [ |
'IMG' |
], |
- allowedAttributes: [ |
+ allowedAttributes: const [ |
'IMG::align', |
'IMG::alt', |
'IMG::border', |
@@ -39519,14 +39519,14 @@ class _SimpleNodeValidator implements NodeValidator { |
'IMG::vspace', |
'IMG::width', |
], |
- allowedUriAttributes: [ |
+ allowedUriAttributes: const [ |
'IMG::src', |
]); |
} |
factory _SimpleNodeValidator.allowTextElements() { |
return new _SimpleNodeValidator(null, |
- allowedElements: [ |
+ allowedElements: const [ |
'B', |
'BLOCKQUOTE', |
'BR', |
@@ -39554,13 +39554,18 @@ class _SimpleNodeValidator implements NodeValidator { |
*/ |
_SimpleNodeValidator(this.uriPolicy, |
{Iterable<String> allowedElements, Iterable<String> allowedAttributes, |
- Iterable<String> allowedUriAttributes}): |
- this.allowedElements = allowedElements != null ? |
- new Set.from(allowedElements) : new Set(), |
- this.allowedAttributes = allowedAttributes != null ? |
- new Set.from(allowedAttributes) : new Set(), |
- this.allowedUriAttributes = allowedUriAttributes != null ? |
- new Set.from(allowedUriAttributes) : new Set(); |
+ Iterable<String> allowedUriAttributes}) { |
+ this.allowedElements.addAll(allowedElements ?? const []); |
+ allowedAttributes = allowedAttributes ?? const []; |
+ allowedUriAttributes = allowedUriAttributes ?? const []; |
+ var legalAttributes = allowedAttributes.where( |
+ (x) => !_Html5NodeValidator._uriAttributes.contains(x)); |
+ var extraUriAttributes = allowedAttributes.where( |
+ (x) => _Html5NodeValidator._uriAttributes.contains(x)); |
+ this.allowedAttributes.addAll(legalAttributes); |
+ this.allowedUriAttributes.addAll(allowedUriAttributes); |
+ this.allowedUriAttributes.addAll(extraUriAttributes); |
+ } |
bool allowsElement(Element element) { |
return allowedElements.contains(element.tagName); |