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

Unified Diff: pkg/custom_element/lib/src/custom_tag_name.dart

Issue 20886002: add custom_element package (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/custom_element/lib/custom_element.dart ('k') | pkg/custom_element/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/custom_element/lib/src/custom_tag_name.dart
diff --git a/pkg/custom_element/lib/src/custom_tag_name.dart b/pkg/custom_element/lib/src/custom_tag_name.dart
new file mode 100644
index 0000000000000000000000000000000000000000..72d915039db8b5d8d046de806898d554a337dfec
--- /dev/null
+++ b/pkg/custom_element/lib/src/custom_tag_name.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library custom_element.src.custom_tag_name;
+
+/**
+ * Returns true if this is a valid custom element name. See:
+ * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-name>
+ */
+bool isCustomTag(String name) {
+ if (!name.contains('-')) return false;
+
+ // These names have meaning in SVG or MathML, so they aren't allowed as custom
+ // tags.
+ var invalidNames = const {
+ 'annotation-xml': '',
+ 'color-profile': '',
+ 'font-face': '',
+ 'font-face-src': '',
+ 'font-face-uri': '',
+ 'font-face-format': '',
+ 'font-face-name': '',
+ 'missing-glyph': '',
+ };
+ return !invalidNames.containsKey(name);
+}
« no previous file with comments | « pkg/custom_element/lib/custom_element.dart ('k') | pkg/custom_element/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698