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

Side by Side Diff: tools/dom/src/NodeValidatorBuilder.dart

Issue 2827793002: Format all files under tools and utils directory. (Closed)
Patch Set: Format all files under tools and utils directory. Created 3 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 unified diff | Download patch
« no previous file with comments | « tools/dom/src/KeyboardEventStream.dart ('k') | tools/dom/src/Validators.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Class which helps construct standard node validation policies. 8 * Class which helps construct standard node validation policies.
9 * 9 *
10 * By default this will not accept anything, but the 'allow*' functions can be 10 * By default this will not accept anything, but the 'allow*' functions can be
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 * This will allow the elements as custom tags (such as <x-foo></x-foo>), 147 * This will allow the elements as custom tags (such as <x-foo></x-foo>),
148 * but will not allow tag extensions. Use [allowTagExtension] to allow 148 * but will not allow tag extensions. Use [allowTagExtension] to allow
149 * tag extensions. 149 * tag extensions.
150 */ 150 */
151 void allowCustomElement(String tagName, 151 void allowCustomElement(String tagName,
152 {UriPolicy uriPolicy, 152 {UriPolicy uriPolicy,
153 Iterable<String> attributes, 153 Iterable<String> attributes,
154 Iterable<String> uriAttributes}) { 154 Iterable<String> uriAttributes}) {
155 var tagNameUpper = tagName.toUpperCase(); 155 var tagNameUpper = tagName.toUpperCase();
156 var attrs = attributes 156 var attrs = attributes
157 ?.map /*<String>*/ ((name) => '$tagNameUpper::${name.toLowerCase()}'); 157 ?.map/*<String>*/((name) => '$tagNameUpper::${name.toLowerCase()}');
158 var uriAttrs = uriAttributes 158 var uriAttrs = uriAttributes
159 ?.map /*<String>*/ ((name) => '$tagNameUpper::${name.toLowerCase()}'); 159 ?.map/*<String>*/((name) => '$tagNameUpper::${name.toLowerCase()}');
160 if (uriPolicy == null) { 160 if (uriPolicy == null) {
161 uriPolicy = new UriPolicy(); 161 uriPolicy = new UriPolicy();
162 } 162 }
163 163
164 add(new _CustomElementNodeValidator( 164 add(new _CustomElementNodeValidator(
165 uriPolicy, [tagNameUpper], attrs, uriAttrs, false, true)); 165 uriPolicy, [tagNameUpper], attrs, uriAttrs, false, true));
166 } 166 }
167 167
168 /** 168 /**
169 * Allow custom tag extensions with the specified type name and specified 169 * Allow custom tag extensions with the specified type name and specified
170 * attributes. 170 * attributes.
171 * 171 *
172 * This will allow tag extensions (such as <div is="x-foo"></div>), 172 * This will allow tag extensions (such as <div is="x-foo"></div>),
173 * but will not allow custom tags. Use [allowCustomElement] to allow 173 * but will not allow custom tags. Use [allowCustomElement] to allow
174 * custom tags. 174 * custom tags.
175 */ 175 */
176 void allowTagExtension(String tagName, String baseName, 176 void allowTagExtension(String tagName, String baseName,
177 {UriPolicy uriPolicy, 177 {UriPolicy uriPolicy,
178 Iterable<String> attributes, 178 Iterable<String> attributes,
179 Iterable<String> uriAttributes}) { 179 Iterable<String> uriAttributes}) {
180 var baseNameUpper = baseName.toUpperCase(); 180 var baseNameUpper = baseName.toUpperCase();
181 var tagNameUpper = tagName.toUpperCase(); 181 var tagNameUpper = tagName.toUpperCase();
182 var attrs = attributes 182 var attrs = attributes
183 ?.map /*<String>*/ ((name) => '$baseNameUpper::${name.toLowerCase()}'); 183 ?.map/*<String>*/((name) => '$baseNameUpper::${name.toLowerCase()}');
184 var uriAttrs = uriAttributes 184 var uriAttrs = uriAttributes
185 ?.map /*<String>*/ ((name) => '$baseNameUpper::${name.toLowerCase()}'); 185 ?.map/*<String>*/((name) => '$baseNameUpper::${name.toLowerCase()}');
186 if (uriPolicy == null) { 186 if (uriPolicy == null) {
187 uriPolicy = new UriPolicy(); 187 uriPolicy = new UriPolicy();
188 } 188 }
189 189
190 add(new _CustomElementNodeValidator(uriPolicy, 190 add(new _CustomElementNodeValidator(uriPolicy,
191 [tagNameUpper, baseNameUpper], attrs, uriAttrs, true, false)); 191 [tagNameUpper, baseNameUpper], attrs, uriAttrs, true, false));
192 } 192 }
193 193
194 void allowElement(String tagName, 194 void allowElement(String tagName,
195 {UriPolicy uriPolicy, 195 {UriPolicy uriPolicy,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 return false; 445 return false;
446 } 446 }
447 447
448 bool allowsAttribute(Element element, String attributeName, String value) { 448 bool allowsAttribute(Element element, String attributeName, String value) {
449 if (attributeName == 'is' || attributeName.startsWith('on')) { 449 if (attributeName == 'is' || attributeName.startsWith('on')) {
450 return false; 450 return false;
451 } 451 }
452 return allowsElement(element); 452 return allowsElement(element);
453 } 453 }
454 } 454 }
OLDNEW
« no previous file with comments | « tools/dom/src/KeyboardEventStream.dart ('k') | tools/dom/src/Validators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698