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 library custom_element.src.custom_tag_name; | 5 library polymer.src.custom_tag_name; |
6 | 6 |
7 /** | 7 /** |
8 * Returns true if this is a valid custom element name. See: | 8 * Returns true if this is a valid custom element name. See: |
9 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn
-custom-element-name> | 9 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn
-custom-element-name> |
10 */ | 10 */ |
11 bool isCustomTag(String name) { | 11 bool isCustomTag(String name) { |
12 if (!name.contains('-')) return false; | 12 if (name == null || !name.contains('-')) return false; |
13 | 13 |
14 // These names have meaning in SVG or MathML, so they aren't allowed as custom | 14 // These names have meaning in SVG or MathML, so they aren't allowed as custom |
15 // tags. | 15 // tags. |
16 var invalidNames = const { | 16 var invalidNames = const { |
17 'annotation-xml': '', | 17 'annotation-xml': '', |
18 'color-profile': '', | 18 'color-profile': '', |
19 'font-face': '', | 19 'font-face': '', |
20 'font-face-src': '', | 20 'font-face-src': '', |
21 'font-face-uri': '', | 21 'font-face-uri': '', |
22 'font-face-format': '', | 22 'font-face-format': '', |
23 'font-face-name': '', | 23 'font-face-name': '', |
24 'missing-glyph': '', | 24 'missing-glyph': '', |
25 }; | 25 }; |
26 return !invalidNames.containsKey(name); | 26 return !invalidNames.containsKey(name); |
27 } | 27 } |
OLD | NEW |