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

Unified Diff: pkg/polymer/lib/src/build/common.dart

Issue 211393006: Enables codegen support in polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/polymer/lib/deploy.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/common.dart
diff --git a/pkg/polymer/lib/src/build/common.dart b/pkg/polymer/lib/src/build/common.dart
index 2510742a3aeb6f859ead651e16fca4ed6f5eac56..26e6a2626553adadc5e01687781d2677d0d1c74e 100644
--- a/pkg/polymer/lib/src/build/common.dart
+++ b/pkg/polymer/lib/src/build/common.dart
@@ -188,3 +188,27 @@ class _ErrorCollector extends AnalysisErrorListener {
final errors = <AnalysisError>[];
onError(error) => errors.add(error);
}
+
+/// These names have meaning in SVG or MathML, so they aren't allowed as custom
+/// tags. See [isCustomTagName].
+const invalidTagNames = const {
+ 'annotation-xml': '',
+ 'color-profile': '',
+ 'font-face': '',
+ 'font-face-src': '',
+ 'font-face-uri': '',
+ 'font-face-format': '',
+ 'font-face-name': '',
+ 'missing-glyph': '',
+};
+
+/// Returns true if this is a valid custom element name. See:
+/// <http://w3c.github.io/webcomponents/spec/custom/#dfn-custom-element-type>
+bool isCustomTagName(String name) {
+ if (name == null || !name.contains('-')) return false;
+ return !invalidTagNames.containsKey(name);
+}
+
+/// Regex to split names in the 'attributes' attribute, which supports 'a b c',
+/// 'a,b,c', or even 'a b,c'. This is the same as in `lib/src/declaration.dart`.
+final ATTRIBUTES_REGEX = new RegExp(r'\s|,');
« no previous file with comments | « pkg/polymer/lib/deploy.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698