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

Unified Diff: pkg/polymer/bin/new_element.dart

Issue 576293002: make public the html element names map (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: move message Created 6 years, 3 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/CHANGELOG.md ('k') | pkg/polymer/lib/html_element_names.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/bin/new_element.dart
diff --git a/pkg/polymer/bin/new_element.dart b/pkg/polymer/bin/new_element.dart
index 2440cdda72a125b070ea5eecc7779bbae4508bca..44374387357bc12d72de7abd2c6409bfde080b3d 100644
--- a/pkg/polymer/bin/new_element.dart
+++ b/pkg/polymer/bin/new_element.dart
@@ -9,6 +9,7 @@
import 'dart:io';
import 'package:args/args.dart';
import 'package:path/path.dart' as path show absolute, dirname, join, split;
+import 'package:polymer/html_element_names.dart';
void printUsage(ArgParser parser) {
print('pub run polymer:new_element [-o output_dir] [-e super-element] '
@@ -126,7 +127,7 @@ String _findDirWithFile(String dir, String filename) {
return dir;
}
-bool _isDOMElement(String element) => (_htmlElementNames[element] != null);
+bool _isDOMElement(String element) => (HTML_ELEMENT_NAMES[element] != null);
bool _isPolymerElement(String element) {
return element.contains('-') && (element.toLowerCase() == element);
@@ -167,7 +168,7 @@ void _createBoilerPlate(String element, String superClass, String directory,
// The element being extended is a DOM Class.
importDartHtml = "import 'dart:html';\n";
classDeclaration =
- 'class $capitalizedName extends ${_htmlElementNames[superClass]} '
+ 'class $capitalizedName extends ${HTML_ELEMENT_NAMES[superClass]} '
'with Polymer, Observable {';
polymerCreatedString = '\n polymerCreated();';
extendsElementString = ' extends="$superClass"';
@@ -242,128 +243,3 @@ $classDeclaration
print(' ' + path.absolute(path.join(directory, underscoreName + '.dart')));
print(' ' + path.absolute(path.join(directory, underscoreName + '.html')));
}
-
-/**
- * HTML element to DOM type mapping. Source:
- * <http://dev.w3.org/html5/spec/section-index.html#element-interfaces>
- *
- * The 'HTML' prefix has been removed to match `dart:html`, as per:
- * <http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/lib/html/scripts/htmlrenamer.py>
- * It does not appear any element types are being renamed other than the prefix.
- * However there does not appear to be the last subtypes for the following tags:
- * command, data, dialog, td, th, and time.
- */
-const _htmlElementNames = const {
- 'a': 'AnchorElement',
- 'abbr': 'Element',
- 'address': 'Element',
- 'area': 'AreaElement',
- 'article': 'Element',
- 'aside': 'Element',
- 'audio': 'AudioElement',
- 'b': 'Element',
- 'base': 'BaseElement',
- 'bdi': 'Element',
- 'bdo': 'Element',
- 'blockquote': 'QuoteElement',
- 'body': 'BodyElement',
- 'br': 'BRElement',
- 'button': 'ButtonElement',
- 'canvas': 'CanvasElement',
- 'caption': 'TableCaptionElement',
- 'cite': 'Element',
- 'code': 'Element',
- 'col': 'TableColElement',
- 'colgroup': 'TableColElement',
- 'command': 'Element', // see doc comment, was: 'CommandElement'
- 'data': 'Element', // see doc comment, was: 'DataElement'
- 'datalist': 'DataListElement',
- 'dd': 'Element',
- 'del': 'ModElement',
- 'details': 'DetailsElement',
- 'dfn': 'Element',
- 'dialog': 'Element', // see doc comment, was: 'DialogElement'
- 'div': 'DivElement',
- 'dl': 'DListElement',
- 'dt': 'Element',
- 'em': 'Element',
- 'embed': 'EmbedElement',
- 'fieldset': 'FieldSetElement',
- 'figcaption': 'Element',
- 'figure': 'Element',
- 'footer': 'Element',
- 'form': 'FormElement',
- 'h1': 'HeadingElement',
- 'h2': 'HeadingElement',
- 'h3': 'HeadingElement',
- 'h4': 'HeadingElement',
- 'h5': 'HeadingElement',
- 'h6': 'HeadingElement',
- 'head': 'HeadElement',
- 'header': 'Element',
- 'hgroup': 'Element',
- 'hr': 'HRElement',
- 'html': 'HtmlElement',
- 'i': 'Element',
- 'iframe': 'IFrameElement',
- 'img': 'ImageElement',
- 'input': 'InputElement',
- 'ins': 'ModElement',
- 'kbd': 'Element',
- 'keygen': 'KeygenElement',
- 'label': 'LabelElement',
- 'legend': 'LegendElement',
- 'li': 'LIElement',
- 'link': 'LinkElement',
- 'map': 'MapElement',
- 'mark': 'Element',
- 'menu': 'MenuElement',
- 'meta': 'MetaElement',
- 'meter': 'MeterElement',
- 'nav': 'Element',
- 'noscript': 'Element',
- 'object': 'ObjectElement',
- 'ol': 'OListElement',
- 'optgroup': 'OptGroupElement',
- 'option': 'OptionElement',
- 'output': 'OutputElement',
- 'p': 'ParagraphElement',
- 'param': 'ParamElement',
- 'pre': 'PreElement',
- 'progress': 'ProgressElement',
- 'q': 'QuoteElement',
- 'rp': 'Element',
- 'rt': 'Element',
- 'ruby': 'Element',
- 's': 'Element',
- 'samp': 'Element',
- 'script': 'ScriptElement',
- 'section': 'Element',
- 'select': 'SelectElement',
- 'small': 'Element',
- 'source': 'SourceElement',
- 'span': 'SpanElement',
- 'strong': 'Element',
- 'style': 'StyleElement',
- 'sub': 'Element',
- 'summary': 'Element',
- 'sup': 'Element',
- 'table': 'TableElement',
- 'tbody': 'TableSectionElement',
- 'td': 'TableCellElement', // see doc comment, was: 'TableDataCellElement'
- 'template': 'Element', // should be 'TemplateElement', but it is not yet
- // in dart:html
- 'textarea': 'TextAreaElement',
- 'tfoot': 'TableSectionElement',
- 'th': 'TableCellElement', // see doc comment, was: 'TableHeaderCellElement'
- 'thead': 'TableSectionElement',
- 'time': 'Element', // see doc comment, was: 'TimeElement'
- 'title': 'TitleElement',
- 'tr': 'TableRowElement',
- 'track': 'TrackElement',
- 'u': 'Element',
- 'ul': 'UListElement',
- 'var': 'Element',
- 'video': 'VideoElement',
- 'wbr': 'Element',
-};
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/html_element_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698