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

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

Issue 1072893002: Fix node validation for SVG foreignobject tag (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « tests/html/node_validator_test.dart ('k') | no next file » | 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 /** 8 /**
9 * Class which helps construct standard node validation policies. 9 * Class which helps construct standard node validation policies.
10 * 10 *
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 449
450 450
451 class _SvgNodeValidator implements NodeValidator { 451 class _SvgNodeValidator implements NodeValidator {
452 bool allowsElement(Element element) { 452 bool allowsElement(Element element) {
453 if (element is svg.ScriptElement) { 453 if (element is svg.ScriptElement) {
454 return false; 454 return false;
455 } 455 }
456 // Firefox 37 has issues with creating foreign elements inside a 456 // Firefox 37 has issues with creating foreign elements inside a
457 // foreignobject tag as SvgElement. We don't want foreignobject contents 457 // foreignobject tag as SvgElement. We don't want foreignobject contents
458 // anyway, so just remove the whole tree outright. 458 // anyway, so just remove the whole tree outright. And we can't rely
459 if (element is svg.ForeignObjectElement) { 459 // on IE recognizing the SvgForeignObject type, so go by tagName. Bug 23144
460 if (element is svg.SvgElement && element.tagName == 'foreignObject') {
460 return false; 461 return false;
461 } 462 }
462 if (element is svg.SvgElement) { 463 if (element is svg.SvgElement) {
463 return true; 464 return true;
464 } 465 }
465 return false; 466 return false;
466 } 467 }
467 468
468 bool allowsAttribute(Element element, String attributeName, String value) { 469 bool allowsAttribute(Element element, String attributeName, String value) {
469 if (attributeName == 'is' || attributeName.startsWith('on')) { 470 if (attributeName == 'is' || attributeName.startsWith('on')) {
470 return false; 471 return false;
471 } 472 }
472 return allowsElement(element); 473 return allowsElement(element);
473 } 474 }
474 } 475 }
OLDNEW
« no previous file with comments | « tests/html/node_validator_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698