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

Side by Side Diff: tools/dom/src/Html5NodeValidator.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/EventStreamProvider.dart ('k') | tools/dom/src/KeyCode.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 // 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.
11 * 11 *
12 * This contains a whitelist of known HTML tagNames and attributes and will only 12 * This contains a whitelist of known HTML tagNames and attributes and will only
13 * accept known good values. 13 * accept known good values.
14 * 14 *
15 * See also: 15 * See also:
16 * 16 *
17 * * <https://code.google.com/p/google-caja/wiki/CajaWhitelists> 17 * * <https://code.google.com/p/google-caja/wiki/CajaWhitelists>
18 */ 18 */
19 class _Html5NodeValidator implements NodeValidator { 19 class _Html5NodeValidator implements NodeValidator {
20
21 static final Set<String> _allowedElements = new Set.from([ 20 static final Set<String> _allowedElements = new Set.from([
22 'A', 21 'A',
23 'ABBR', 22 'ABBR',
24 'ACRONYM', 23 'ACRONYM',
25 'ADDRESS', 24 'ADDRESS',
26 'AREA', 25 'AREA',
27 'ARTICLE', 26 'ARTICLE',
28 'ASIDE', 27 'ASIDE',
29 'AUDIO', 28 'AUDIO',
30 'B', 29 'B',
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 402
404 final UriPolicy uriPolicy; 403 final UriPolicy uriPolicy;
405 404
406 static final Map<String, Function> _attributeValidators = {}; 405 static final Map<String, Function> _attributeValidators = {};
407 406
408 /** 407 /**
409 * All known URI attributes will be validated against the UriPolicy, if 408 * All known URI attributes will be validated against the UriPolicy, if
410 * [uriPolicy] is null then a default UriPolicy will be used. 409 * [uriPolicy] is null then a default UriPolicy will be used.
411 */ 410 */
412 _Html5NodeValidator({UriPolicy uriPolicy}) 411 _Html5NodeValidator({UriPolicy uriPolicy})
413 :uriPolicy = uriPolicy != null ? uriPolicy : new UriPolicy() { 412 : uriPolicy = uriPolicy != null ? uriPolicy : new UriPolicy() {
414
415 if (_attributeValidators.isEmpty) { 413 if (_attributeValidators.isEmpty) {
416 for (var attr in _standardAttributes) { 414 for (var attr in _standardAttributes) {
417 _attributeValidators[attr] = _standardAttributeValidator; 415 _attributeValidators[attr] = _standardAttributeValidator;
418 } 416 }
419 417
420 for (var attr in _uriAttributes) { 418 for (var attr in _uriAttributes) {
421 _attributeValidators[attr] = _uriAttributeValidator; 419 _attributeValidators[attr] = _uriAttributeValidator;
422 } 420 }
423 } 421 }
424 } 422 }
(...skipping 17 matching lines...) Expand all
442 static bool _standardAttributeValidator(Element element, String attributeName, 440 static bool _standardAttributeValidator(Element element, String attributeName,
443 String value, _Html5NodeValidator context) { 441 String value, _Html5NodeValidator context) {
444 return true; 442 return true;
445 } 443 }
446 444
447 static bool _uriAttributeValidator(Element element, String attributeName, 445 static bool _uriAttributeValidator(Element element, String attributeName,
448 String value, _Html5NodeValidator context) { 446 String value, _Html5NodeValidator context) {
449 return context.uriPolicy.allowsUri(value); 447 return context.uriPolicy.allowsUri(value);
450 } 448 }
451 } 449 }
OLDNEW
« no previous file with comments | « tools/dom/src/EventStreamProvider.dart ('k') | tools/dom/src/KeyCode.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698