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 implements NodeListWrapper { | 8 implements NodeListWrapper { |
9 // Raw Element. | 9 // Raw Element. |
10 final Element _element; | 10 final Element _element; |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 * Adds the specified text after the last child of this element. | 720 * Adds the specified text after the last child of this element. |
721 */ | 721 */ |
722 void appendText(String text) { | 722 void appendText(String text) { |
723 this.append(new Text(text)); | 723 this.append(new Text(text)); |
724 } | 724 } |
725 | 725 |
726 /** | 726 /** |
727 * Parses the specified text as HTML and adds the resulting node after the | 727 * Parses the specified text as HTML and adds the resulting node after the |
728 * last child of this element. | 728 * last child of this element. |
729 */ | 729 */ |
730 void appendHtml(String text, {NodeValidator validator, | 730 void appendHtml(String text) { |
731 NodeTreeSanitizer treeSanitizer}) { | 731 this.insertAdjacentHtml('beforeend', text); |
732 this.insertAdjacentHtml('beforeend', text, validator: validator, | |
733 treeSanitizer: treeSanitizer); | |
734 } | 732 } |
735 | 733 |
736 /** | 734 /** |
737 * Checks to see if the tag name is supported by the current platform. | 735 * Checks to see if the tag name is supported by the current platform. |
738 * | 736 * |
739 * The tag should be a valid HTML tag name. | 737 * The tag should be a valid HTML tag name. |
740 */ | 738 */ |
741 static bool isTagSupported(String tag) { | 739 static bool isTagSupported(String tag) { |
742 var e = _ElementFactoryProvider.createElement_tag(tag, null); | 740 var e = _ElementFactoryProvider.createElement_tag(tag, null); |
743 return e is Element && !(e is UnknownElement); | 741 return e is Element && !(e is UnknownElement); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 * // Inserts as the first child | 1000 * // Inserts as the first child |
1003 * document.body.insertAdjacentHtml('afterBegin', html); | 1001 * document.body.insertAdjacentHtml('afterBegin', html); |
1004 * var createdElement = document.body.children[0]; | 1002 * var createdElement = document.body.children[0]; |
1005 * print(createdElement.classes[0]); // Prints 'something' | 1003 * print(createdElement.classes[0]); // Prints 'something' |
1006 * | 1004 * |
1007 * See also: | 1005 * See also: |
1008 * | 1006 * |
1009 * * [insertAdjacentText] | 1007 * * [insertAdjacentText] |
1010 * * [insertAdjacentElement] | 1008 * * [insertAdjacentElement] |
1011 */ | 1009 */ |
1012 void insertAdjacentHtml(String where, String html, {NodeValidator validator, | 1010 void insertAdjacentHtml(String where, String html) { |
1013 NodeTreeSanitizer treeSanitizer}) { | 1011 if (JS('bool', '!!#.insertAdjacentHTML', this)) { |
1014 _insertAdjacentNode(where, new DocumentFragment.html(html, | 1012 _insertAdjacentHtml(where, html); |
1015 validator: validator, treeSanitizer: treeSanitizer)); | 1013 } else { |
| 1014 _insertAdjacentNode(where, new DocumentFragment.html(html)); |
| 1015 } |
1016 } | 1016 } |
1017 | 1017 |
1018 @JSName('insertAdjacentHTML') | 1018 @JSName('insertAdjacentHTML') |
1019 void _insertAdjacentHtml(String where, String text) native; | 1019 void _insertAdjacentHtml(String where, String text) native; |
1020 | 1020 |
1021 /** | 1021 /** |
1022 * Inserts [element] into the DOM at the specified location. | 1022 * Inserts [element] into the DOM at the specified location. |
1023 * | 1023 * |
1024 * To see the possible values for [where], read the doc for | 1024 * To see the possible values for [where], read the doc for |
1025 * [insertAdjacentHtml]. | 1025 * [insertAdjacentHtml]. |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 const ScrollAlignment._internal(this._value); | 1566 const ScrollAlignment._internal(this._value); |
1567 toString() => 'ScrollAlignment.$_value'; | 1567 toString() => 'ScrollAlignment.$_value'; |
1568 | 1568 |
1569 /// Attempt to align the element to the top of the scrollable area. | 1569 /// Attempt to align the element to the top of the scrollable area. |
1570 static const TOP = const ScrollAlignment._internal('TOP'); | 1570 static const TOP = const ScrollAlignment._internal('TOP'); |
1571 /// Attempt to center the element in the scrollable area. | 1571 /// Attempt to center the element in the scrollable area. |
1572 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1572 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1573 /// Attempt to align the element to the bottom of the scrollable area. | 1573 /// Attempt to align the element to the bottom of the scrollable area. |
1574 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1574 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1575 } | 1575 } |
OLD | NEW |