| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |