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

Side by Side Diff: lib/src/html5_utils.dart

Issue 11412285: New pub release - changes to comply with new SDK. (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years 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 unified diff | Download patch
« no previous file with comments | « lib/src/html5_setters.g.dart ('k') | lib/web_components.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
11 /** 11 /**
12 * Maps an HTML tag to a dart:html type. This uses [htmlElementNames] but it 12 * Maps an HTML tag to a dart:html type. This uses [htmlElementNames] but it
13 * will return UnknownElement if the tag is unknown. 13 * will return UnknownElement if the tag is unknown.
14 */ 14 */
15 String typeForHtmlTag(String tag) { 15 String typeForHtmlTag(String tag) {
16 var type = htmlElementNames[tag]; 16 var type = htmlElementNames[tag];
17 // Note: this will eventually be the component's class name if it is a 17 // Note: this will eventually be the component's class name if it is a
18 // known x-tag. 18 // known x-tag.
19 return type == null ? 'UnknownElement' : type; 19 return type == null ? 'html.UnknownElement' : type;
20 } 20 }
21 21
22 /** 22 /**
23 * HTML element to DOM type mapping. Source: 23 * HTML element to DOM type mapping. Source:
24 * <http://dev.w3.org/html5/spec/section-index.html#element-interfaces> 24 * <http://dev.w3.org/html5/spec/section-index.html#element-interfaces>
25 * 25 *
26 * 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:
27 * <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>
28 * 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.
29 * 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:
30 * command, data, dialog, td, th, and time. 30 * command, data, dialog, td, th, and time.
31 */ 31 */
32 const htmlElementNames = const { 32 const htmlElementNames = const {
33 'a': 'AnchorElement', 33 'a': 'html.AnchorElement',
34 'abbr': 'Element', 34 'abbr': 'html.Element',
35 'address': 'Element', 35 'address': 'html.Element',
36 'area': 'AreaElement', 36 'area': 'html.AreaElement',
37 'article': 'Element', 37 'article': 'html.Element',
38 'aside': 'Element', 38 'aside': 'html.Element',
39 'audio': 'AudioElement', 39 'audio': 'web_audio.AudioElement',
40 'b': 'Element', 40 'b': 'html.Element',
41 'base': 'BaseElement', 41 'base': 'html.BaseElement',
42 'bdi': 'Element', 42 'bdi': 'html.Element',
43 'bdo': 'Element', 43 'bdo': 'html.Element',
44 'blockquote': 'QuoteElement', 44 'blockquote': 'html.QuoteElement',
45 'body': 'BodyElement', 45 'body': 'html.BodyElement',
46 'br': 'BRElement', 46 'br': 'html.BRElement',
47 'button': 'ButtonElement', 47 'button': 'html.ButtonElement',
48 'canvas': 'CanvasElement', 48 'canvas': 'html.CanvasElement',
49 'caption': 'TableCaptionElement', 49 'caption': 'html.TableCaptionElement',
50 'cite': 'Element', 50 'cite': 'html.Element',
51 'code': 'Element', 51 'code': 'html.Element',
52 'col': 'TableColElement', 52 'col': 'html.TableColElement',
53 'colgroup': 'TableColElement', 53 'colgroup': 'html.TableColElement',
54 'command': 'Element', // see doc comment, was: 'CommandElement' 54 'command': 'html.Element', // see doc comment, was: 'CommandElement'
55 'data': 'Element', // see doc comment, was: 'DataElement' 55 'data': 'html.Element', // see doc comment, was: 'DataElement'
56 'datalist': 'DataListElement', 56 'datalist': 'html.DataListElement',
57 'dd': 'Element', 57 'dd': 'html.Element',
58 'del': 'ModElement', 58 'del': 'html.ModElement',
59 'details': 'DetailsElement', 59 'details': 'html.DetailsElement',
60 'dfn': 'Element', 60 'dfn': 'html.Element',
61 'dialog': 'Element', // see doc comment, was: 'DialogElement' 61 'dialog': 'html.Element', // see doc comment, was: 'DialogElement'
62 'div': 'DivElement', 62 'div': 'html.DivElement',
63 'dl': 'DListElement', 63 'dl': 'html.DListElement',
64 'dt': 'Element', 64 'dt': 'html.Element',
65 'em': 'Element', 65 'em': 'html.Element',
66 'embed': 'EmbedElement', 66 'embed': 'html.EmbedElement',
67 'fieldset': 'FieldSetElement', 67 'fieldset': 'html.FieldSetElement',
68 'figcaption': 'Element', 68 'figcaption': 'html.Element',
69 'figure': 'Element', 69 'figure': 'html.Element',
70 'footer': 'Element', 70 'footer': 'html.Element',
71 'form': 'FormElement', 71 'form': 'html.FormElement',
72 'h1': 'HeadingElement', 72 'h1': 'html.HeadingElement',
73 'h2': 'HeadingElement', 73 'h2': 'html.HeadingElement',
74 'h3': 'HeadingElement', 74 'h3': 'html.HeadingElement',
75 'h4': 'HeadingElement', 75 'h4': 'html.HeadingElement',
76 'h5': 'HeadingElement', 76 'h5': 'html.HeadingElement',
77 'h6': 'HeadingElement', 77 'h6': 'html.HeadingElement',
78 'head': 'HeadElement', 78 'head': 'html.HeadElement',
79 'header': 'Element', 79 'header': 'html.Element',
80 'hgroup': 'Element', 80 'hgroup': 'html.Element',
81 'hr': 'HRElement', 81 'hr': 'html.HRElement',
82 'html': 'HtmlElement', 82 'html': 'html.HtmlElement',
83 'i': 'Element', 83 'i': 'html.Element',
84 'iframe': 'IFrameElement', 84 'iframe': 'html.IFrameElement',
85 'img': 'ImageElement', 85 'img': 'html.ImageElement',
86 'input': 'InputElement', 86 'input': 'html.InputElement',
87 'ins': 'ModElement', 87 'ins': 'html.ModElement',
88 'kbd': 'Element', 88 'kbd': 'html.Element',
89 'keygen': 'KeygenElement', 89 'keygen': 'html.KeygenElement',
90 'label': 'LabelElement', 90 'label': 'html.LabelElement',
91 'legend': 'LegendElement', 91 'legend': 'html.LegendElement',
92 'li': 'LIElement', 92 'li': 'html.LIElement',
93 'link': 'LinkElement', 93 'link': 'html.LinkElement',
94 'map': 'MapElement', 94 'map': 'html.MapElement',
95 'mark': 'Element', 95 'mark': 'html.Element',
96 'menu': 'MenuElement', 96 'menu': 'html.MenuElement',
97 'meta': 'MetaElement', 97 'meta': 'html.MetaElement',
98 'meter': 'MeterElement', 98 'meter': 'html.MeterElement',
99 'nav': 'Element', 99 'nav': 'html.Element',
100 'noscript': 'Element', 100 'noscript': 'html.Element',
101 'object': 'ObjectElement', 101 'object': 'html.ObjectElement',
102 'ol': 'OListElement', 102 'ol': 'html.OListElement',
103 'optgroup': 'OptGroupElement', 103 'optgroup': 'html.OptGroupElement',
104 'option': 'OptionElement', 104 'option': 'html.OptionElement',
105 'output': 'OutputElement', 105 'output': 'html.OutputElement',
106 'p': 'ParagraphElement', 106 'p': 'html.ParagraphElement',
107 'param': 'ParamElement', 107 'param': 'html.ParamElement',
108 'pre': 'PreElement', 108 'pre': 'html.PreElement',
109 'progress': 'ProgressElement', 109 'progress': 'html.ProgressElement',
110 'q': 'QuoteElement', 110 'q': 'html.QuoteElement',
111 'rp': 'Element', 111 'rp': 'html.Element',
112 'rt': 'Element', 112 'rt': 'html.Element',
113 'ruby': 'Element', 113 'ruby': 'html.Element',
114 's': 'Element', 114 's': 'html.Element',
115 'samp': 'Element', 115 'samp': 'html.Element',
116 'script': 'ScriptElement', 116 'script': 'html.ScriptElement',
117 'section': 'Element', 117 'section': 'html.Element',
118 'select': 'SelectElement', 118 'select': 'html.SelectElement',
119 'small': 'Element', 119 'small': 'html.Element',
120 'source': 'SourceElement', 120 'source': 'html.SourceElement',
121 'span': 'SpanElement', 121 'span': 'html.SpanElement',
122 'strong': 'Element', 122 'strong': 'html.Element',
123 'style': 'StyleElement', 123 'style': 'html.StyleElement',
124 'sub': 'Element', 124 'sub': 'html.Element',
125 'summary': 'Element', 125 'summary': 'html.Element',
126 'sup': 'Element', 126 'sup': 'html.Element',
127 'table': 'TableElement', 127 'table': 'html.TableElement',
128 'tbody': 'TableSectionElement', 128 'tbody': 'html.TableSectionElement',
129 'td': 'TableCellElement', // see doc comment, was: 'TableDataCellElement' 129 'td': 'html.TableCellElement', // see doc comment, was: 'TableDataCellElement'
130 'textarea': 'TextAreaElement', 130 'textarea': 'html.TextAreaElement',
131 'tfoot': 'TableSectionElement', 131 'tfoot': 'html.TableSectionElement',
132 'th': 'TableCellElement', // see doc comment, was: 'TableHeaderCellElement' 132 'th': 'html.TableCellElement', // see doc comment, was: 'TableHeaderCellElemen t'
133 'thead': 'TableSectionElement', 133 'thead': 'html.TableSectionElement',
134 'time': 'Element', // see doc comment, was: 'TimeElement' 134 'time': 'html.Element', // see doc comment, was: 'TimeElement'
135 'title': 'TitleElement', 135 'title': 'html.TitleElement',
136 'tr': 'TableRowElement', 136 'tr': 'html.TableRowElement',
137 'track': 'TrackElement', 137 'track': 'html.TrackElement',
138 'u': 'Element', 138 'u': 'html.Element',
139 'ul': 'UListElement', 139 'ul': 'html.UListElement',
140 'var': 'Element', 140 'var': 'html.Element',
141 'video': 'VideoElement', 141 'video': 'html.VideoElement',
142 'wbr': 'Element', 142 'wbr': 'html.Element',
143 }; 143 };
144 144
145 145
146 /** 146 /**
147 * HTML attributes that expect a URL value. 147 * HTML attributes that expect a URL value.
148 * <http://dev.w3.org/html5/spec/section-index.html#attributes-1> 148 * <http://dev.w3.org/html5/spec/section-index.html#attributes-1>
149 * 149 *
150 * Every one of these attributes is a URL in every context where it is used in 150 * Every one of these attributes is a URL in every context where it is used in
151 * the DOM. The comments show every DOM element where an attribute can be used. 151 * the DOM. The comments show every DOM element where an attribute can be used.
152 */ 152 */
153 const urlAttributes = const [ 153 const urlAttributes = const [
154 'action', // in form 154 'action', // in form
155 'cite', // in blockquote, del, ins, q 155 'cite', // in blockquote, del, ins, q
156 'data', // in object 156 'data', // in object
157 'formaction', // in button, input 157 'formaction', // in button, input
158 'href', // in a, area, link, base, command 158 'href', // in a, area, link, base, command
159 'manifest', // in html 159 'manifest', // in html
160 'poster', // in video 160 'poster', // in video
161 'src', // in audio, embed, iframe, img, input, script, source, track, 161 'src', // in audio, embed, iframe, img, input, script, source, track,
162 // video 162 // video
163 ]; 163 ];
OLDNEW
« no previous file with comments | « lib/src/html5_setters.g.dart ('k') | lib/web_components.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698