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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 class _ChildrenElementList extends ListBase<Element> { | 7 class _ChildrenElementList extends ListBase<Element> { |
8 // Raw Element. | 8 // Raw Element. |
9 final Element _element; | 9 final Element _element; |
10 final HtmlCollection _childElements; | 10 final HtmlCollection _childElements; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 */ | 327 */ |
328 factory Element.html(String html, | 328 factory Element.html(String html, |
329 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { | 329 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { |
330 var fragment = document.body.createFragment(html, validator: validator, | 330 var fragment = document.body.createFragment(html, validator: validator, |
331 treeSanitizer: treeSanitizer); | 331 treeSanitizer: treeSanitizer); |
332 | 332 |
333 return fragment.nodes.where((e) => e is Element).single; | 333 return fragment.nodes.where((e) => e is Element).single; |
334 } | 334 } |
335 | 335 |
336 /** | 336 /** |
337 * Custom element creation constructor. | |
338 * | |
339 * This constructor is used by the DOM when a custom element has been | |
340 * created. It can only be invoked by subclasses of Element from | |
341 * that classes created constructor. | |
342 * | |
343 * class CustomElement extends Element { | |
344 * factory CustomElement() => new Element.tag('x-custom'); | |
345 * | |
346 * CustomElement.created() : super.created() { | |
347 * // Perform any element initialization. | |
348 * } | |
349 * } | |
350 * document.register('x-custom', CustomElement); | |
351 */ | |
352 Element.created() : super._created() { | |
353 // Validate that this is a custom element & perform any additional | |
354 // initialization. | |
355 _initializeCustomElement(this); | |
356 | |
357 createdCallback(); | |
358 } | |
359 | |
360 /** | |
337 * Creates the HTML element specified by the tag name. | 361 * Creates the HTML element specified by the tag name. |
338 * | 362 * |
339 * This is similar to [Document.createElement]. | 363 * This is similar to [Document.createElement]. |
340 * [tag] should be a valid HTML tag name. If [tag] is an unknown tag then | 364 * [tag] should be a valid HTML tag name. If [tag] is an unknown tag then |
341 * this will create an [UnknownElement]. | 365 * this will create an [UnknownElement]. |
342 * | 366 * |
343 * var divElement = new Element.tag('div'); | 367 * var divElement = new Element.tag('div'); |
344 * print(divElement is DivElement); // 'true' | 368 * print(divElement is DivElement); // 'true' |
345 * var myElement = new Element.tag('unknownTag'); | 369 * var myElement = new Element.tag('unknownTag'); |
346 * print(myElement is UnknownElement); // 'true' | 370 * print(myElement is UnknownElement); // 'true' |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 */ | 695 */ |
672 static bool isTagSupported(String tag) { | 696 static bool isTagSupported(String tag) { |
673 var e = _ElementFactoryProvider.createElement_tag(tag, null); | 697 var e = _ElementFactoryProvider.createElement_tag(tag, null); |
674 return e is Element && !(e is UnknownElement); | 698 return e is Element && !(e is UnknownElement); |
675 } | 699 } |
676 | 700 |
677 /** | 701 /** |
678 * Called by the DOM when this element has been instantiated. | 702 * Called by the DOM when this element has been instantiated. |
679 */ | 703 */ |
680 @Experimental() | 704 @Experimental() |
681 void created() {} | 705 void createdCallback() {} |
vsm
2013/10/01 16:58:01
Mark deprecated?
blois
2013/10/01 20:37:08
Done.
| |
682 | 706 |
683 /** | 707 /** |
684 * Called by the DOM when this element has been inserted into the live | 708 * Called by the DOM when this element has been inserted into the live |
685 * document. | 709 * document. |
686 */ | 710 */ |
687 @Experimental() | 711 @Experimental() |
688 void enteredView() {} | 712 void enteredView() {} |
689 | 713 |
690 /** | 714 /** |
691 * Called by the DOM when this element has been removed from the live | 715 * Called by the DOM when this element has been removed from the live |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1367 const ScrollAlignment._internal(this._value); | 1391 const ScrollAlignment._internal(this._value); |
1368 toString() => 'ScrollAlignment.$_value'; | 1392 toString() => 'ScrollAlignment.$_value'; |
1369 | 1393 |
1370 /// Attempt to align the element to the top of the scrollable area. | 1394 /// Attempt to align the element to the top of the scrollable area. |
1371 static const TOP = const ScrollAlignment._internal('TOP'); | 1395 static const TOP = const ScrollAlignment._internal('TOP'); |
1372 /// Attempt to center the element in the scrollable area. | 1396 /// Attempt to center the element in the scrollable area. |
1373 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1397 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1374 /// Attempt to align the element to the bottom of the scrollable area. | 1398 /// Attempt to align the element to the bottom of the scrollable area. |
1375 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1399 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1376 } | 1400 } |
OLD | NEW |