| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // TODO(jmesserly): html5lib might be a better home for this. | 5 // TODO(jmesserly): html5lib might be a better home for this. |
| 6 // But at the moment we only need it here. | 6 // But at the moment we only need it here. |
| 7 | 7 |
| 8 library html5_utils; | 8 library html5_utils; |
| 9 | 9 |
| 10 |
| 11 /** |
| 12 * Maps an HTML tag to a dart:html type. This uses [htmlElementNames] but it |
| 13 * will return UnknownElement if the tag is unknown. |
| 14 */ |
| 15 String typeForHtmlTag(String tag) { |
| 16 var type = htmlElementNames[tag]; |
| 17 // Note: this will eventually be the component's class name if it is a |
| 18 // known x-tag. |
| 19 return type == null ? 'UnknownElement' : type; |
| 20 } |
| 21 |
| 10 /** | 22 /** |
| 11 * HTML element to DOM type mapping. Source: | 23 * HTML element to DOM type mapping. Source: |
| 12 * <http://dev.w3.org/html5/spec/section-index.html#element-interfaces> | 24 * <http://dev.w3.org/html5/spec/section-index.html#element-interfaces> |
| 13 * | 25 * |
| 14 * The 'HTML' prefix has been removed to match `dart:html`, as per: | 26 * The 'HTML' prefix has been removed to match `dart:html`, as per: |
| 15 * <http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/lib/
html/scripts/htmlrenamer.py> | 27 * <http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/lib/
html/scripts/htmlrenamer.py> |
| 16 * It does not appear any element types are being renamed other than the prefix. | 28 * It does not appear any element types are being renamed other than the prefix. |
| 17 * However there does not appear to be the last subtypes for the following tags: | 29 * However there does not appear to be the last subtypes for the following tags: |
| 18 * command, data, dialog, td, th, and time. | 30 * command, data, dialog, td, th, and time. |
| 19 */ | 31 */ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 'time': 'Element', // see doc comment, was: 'TimeElement' | 134 'time': 'Element', // see doc comment, was: 'TimeElement' |
| 123 'title': 'TitleElement', | 135 'title': 'TitleElement', |
| 124 'tr': 'TableRowElement', | 136 'tr': 'TableRowElement', |
| 125 'track': 'TrackElement', | 137 'track': 'TrackElement', |
| 126 'u': 'Element', | 138 'u': 'Element', |
| 127 'ul': 'UListElement', | 139 'ul': 'UListElement', |
| 128 'var': 'Element', | 140 'var': 'Element', |
| 129 'video': 'VideoElement', | 141 'video': 'VideoElement', |
| 130 'wbr': 'Element', | 142 'wbr': 'Element', |
| 131 }; | 143 }; |
| OLD | NEW |