Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: tools/dom/src/NodeValidatorBuilder.dart

Issue 1894713002: Strong html (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ready for review Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/NodeValidatorBuilder.dart
diff --git a/tools/dom/src/NodeValidatorBuilder.dart b/tools/dom/src/NodeValidatorBuilder.dart
index 24f079b47488f3820612ca58c9b2a965d2953673..7e5bfaa277e3b5bf7ac154dfb961428c369cf563 100644
--- a/tools/dom/src/NodeValidatorBuilder.dart
+++ b/tools/dom/src/NodeValidatorBuilder.dart
@@ -157,16 +157,10 @@ class NodeValidatorBuilder implements NodeValidator {
Iterable<String> uriAttributes}) {
var tagNameUpper = tagName.toUpperCase();
- var attrs;
- if (attributes != null) {
- attrs =
- attributes.map((name) => '$tagNameUpper::${name.toLowerCase()}');
- }
- var uriAttrs;
- if (uriAttributes != null) {
- uriAttrs =
- uriAttributes.map((name) => '$tagNameUpper::${name.toLowerCase()}');
- }
+ var attrs = attributes != null ?
+ attributes.map/*<String>*/((name) => '$tagNameUpper::${name.toLowerCase()}') : null;
+ var uriAttrs = uriAttributes != null ?
+ uriAttributes.map/*<String>*/((name) => '$tagNameUpper::${name.toLowerCase()}') : null;
if (uriPolicy == null) {
uriPolicy = new UriPolicy();
}
@@ -195,16 +189,8 @@ class NodeValidatorBuilder implements NodeValidator {
var baseNameUpper = baseName.toUpperCase();
var tagNameUpper = tagName.toUpperCase();
- var attrs;
- if (attributes != null) {
- attrs =
- attributes.map((name) => '$baseNameUpper::${name.toLowerCase()}');
- }
- var uriAttrs;
- if (uriAttributes != null) {
- uriAttrs =
- uriAttributes.map((name) => '$baseNameUpper::${name.toLowerCase()}');
- }
+ var attrs = attributes != null ? attributes.map/*<String>*/((name) => '$baseNameUpper::${name.toLowerCase()}') : null;
+ var uriAttrs = uriAttributes != null ? uriAttributes.map/*<String>*/((name) => '$baseNameUpper::${name.toLowerCase()}') : null;
if (uriPolicy == null) {
uriPolicy = new UriPolicy();
}
@@ -390,13 +376,12 @@ class _CustomElementNodeValidator extends _SimpleNodeValidator {
Iterable<String> allowedUriAttributes,
bool allowTypeExtension,
bool allowCustomTag):
-
+ this.allowTypeExtension = allowTypeExtension == true,
+ this.allowCustomTag = allowCustomTag == true,
super(uriPolicy,
allowedElements: allowedElements,
allowedAttributes: allowedAttributes,
- allowedUriAttributes: allowedUriAttributes),
- this.allowTypeExtension = allowTypeExtension == true,
- this.allowCustomTag = allowCustomTag == true;
+ allowedUriAttributes: allowedUriAttributes);
bool allowsElement(Element element) {
if (allowTypeExtension) {
@@ -428,12 +413,12 @@ class _TemplatingNodeValidator extends _SimpleNodeValidator {
final Set<String> _templateAttrs;
_TemplatingNodeValidator():
+ _templateAttrs = new Set<String>.from(_TEMPLATE_ATTRS),
super(null,
allowedElements: [
'TEMPLATE'
],
- allowedAttributes: _TEMPLATE_ATTRS.map((attr) => 'TEMPLATE::$attr')),
- _templateAttrs = new Set<String>.from(_TEMPLATE_ATTRS) {
+ allowedAttributes: _TEMPLATE_ATTRS.map((attr) => 'TEMPLATE::$attr')) {
}
bool allowsAttribute(Element element, String attributeName, String value) {

Powered by Google App Engine
This is Rietveld 408576698