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 // WARNING: Do not edit - generated code. | 5 // WARNING: Do not edit - generated code. |
6 | 6 |
7 part of $LIBRARYNAME; | 7 part of $LIBRARYNAME; |
8 | 8 |
9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
10 $!MEMBERS | 10 $!MEMBERS |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 * The class being registered must either subclass HtmlElement or SvgElement. | 212 * The class being registered must either subclass HtmlElement or SvgElement. |
213 * If they subclass these directly then they can be used as: | 213 * If they subclass these directly then they can be used as: |
214 * | 214 * |
215 * class FooElement extends HtmlElement{ | 215 * class FooElement extends HtmlElement{ |
216 * void created() { | 216 * void created() { |
217 * print('FooElement created!'); | 217 * print('FooElement created!'); |
218 * } | 218 * } |
219 * } | 219 * } |
220 * | 220 * |
221 * main() { | 221 * main() { |
222 * document.register('x-foo', FooElement); | 222 * document.registerElement('x-foo', FooElement); |
223 * var myFoo = new Element.tag('x-foo'); | 223 * var myFoo = new Element.tag('x-foo'); |
224 * // prints 'FooElement created!' to the console. | 224 * // prints 'FooElement created!' to the console. |
225 * } | 225 * } |
226 * | 226 * |
227 * The custom element can also be instantiated via HTML using the syntax | 227 * The custom element can also be instantiated via HTML using the syntax |
228 * `<x-foo></x-foo>` | 228 * `<x-foo></x-foo>` |
229 * | 229 * |
230 * Other elements can be subclassed as well: | 230 * Other elements can be subclassed as well: |
231 * | 231 * |
232 * class BarElement extends InputElement{ | 232 * class BarElement extends InputElement{ |
233 * void created() { | 233 * void created() { |
234 * print('BarElement created!'); | 234 * print('BarElement created!'); |
235 * } | 235 * } |
236 * } | 236 * } |
237 * | 237 * |
238 * main() { | 238 * main() { |
239 * document.register('x-bar', BarElement); | 239 * document.registerElement('x-bar', BarElement); |
240 * var myBar = new Element.tag('input', 'x-bar'); | 240 * var myBar = new Element.tag('input', 'x-bar'); |
241 * // prints 'BarElement created!' to the console. | 241 * // prints 'BarElement created!' to the console. |
242 * } | 242 * } |
243 * | 243 * |
244 * This custom element can also be instantiated via HTML using the syntax | 244 * This custom element can also be instantiated via HTML using the syntax |
245 * `<input is="x-bar"></input>` | 245 * `<input is="x-bar"></input>` |
246 * | 246 * |
247 */ | 247 */ |
| 248 void registerElement(String tag, Type customElementClass, |
| 249 {String extendsTag}) { |
248 $if DART2JS | 250 $if DART2JS |
249 void register(String tag, Type customElementClass, {String extendsTag}) { | |
250 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, | 251 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, |
251 extendsTag); | 252 extendsTag); |
| 253 $else |
| 254 _Utils.register(this, tag, customElementClass, extendsTag); |
| 255 $endif |
252 } | 256 } |
253 $else | 257 |
| 258 /** *Deprecated*: use [registerElement] instead. */ |
| 259 @deprecated |
| 260 @Experimental() |
254 void register(String tag, Type customElementClass, {String extendsTag}) { | 261 void register(String tag, Type customElementClass, {String extendsTag}) { |
255 _Utils.register(this, tag, customElementClass, extendsTag); | 262 return registerElement(tag, customElementClass, extendsTag: extendsTag); |
256 } | 263 } |
257 $endif | |
258 | 264 |
259 /** | 265 /** |
260 * Static factory designed to expose `visibilitychange` events to event | 266 * Static factory designed to expose `visibilitychange` events to event |
261 * handlers that are not necessarily instances of [Document]. | 267 * handlers that are not necessarily instances of [Document]. |
262 * | 268 * |
263 * See [EventStreamProvider] for usage information. | 269 * See [EventStreamProvider] for usage information. |
264 */ | 270 */ |
265 @DomName('Document.visibilityChange') | 271 @DomName('Document.visibilityChange') |
266 @SupportedBrowser(SupportedBrowser.CHROME) | 272 @SupportedBrowser(SupportedBrowser.CHROME) |
267 @SupportedBrowser(SupportedBrowser.FIREFOX) | 273 @SupportedBrowser(SupportedBrowser.FIREFOX) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 /// parameter must be provided. | 312 /// parameter must be provided. |
307 @Experimental() | 313 @Experimental() |
308 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { | 314 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
309 $if DART2JS | 315 $if DART2JS |
310 return new _JSElementUpgrader(this, type, extendsTag); | 316 return new _JSElementUpgrader(this, type, extendsTag); |
311 $else | 317 $else |
312 return new _VMElementUpgrader(this, type, extendsTag); | 318 return new _VMElementUpgrader(this, type, extendsTag); |
313 $endif | 319 $endif |
314 } | 320 } |
315 } | 321 } |
OLD | NEW |