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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 * // Inserts as the first child | 1011 * // Inserts as the first child |
1014 * document.body.insertAdjacentHtml('afterBegin', html); | 1012 * document.body.insertAdjacentHtml('afterBegin', html); |
1015 * var createdElement = document.body.children[0]; | 1013 * var createdElement = document.body.children[0]; |
1016 * print(createdElement.classes[0]); // Prints 'something' | 1014 * print(createdElement.classes[0]); // Prints 'something' |
1017 * | 1015 * |
1018 * See also: | 1016 * See also: |
1019 * | 1017 * |
1020 * * [insertAdjacentText] | 1018 * * [insertAdjacentText] |
1021 * * [insertAdjacentElement] | 1019 * * [insertAdjacentElement] |
1022 */ | 1020 */ |
1023 void insertAdjacentHtml(String where, String html, {NodeValidator validator, | 1021 void insertAdjacentHtml(String where, String html) { |
1024 NodeTreeSanitizer treeSanitizer}) { | 1022 if (JS('bool', '!!#.insertAdjacentHTML', this)) { |
1025 _insertAdjacentNode(where, new DocumentFragment.html(html, | 1023 _insertAdjacentHtml(where, html); |
1026 validator: validator, treeSanitizer: treeSanitizer)); | 1024 } else { |
| 1025 _insertAdjacentNode(where, new DocumentFragment.html(html)); |
| 1026 } |
1027 } | 1027 } |
1028 | 1028 |
1029 @JSName('insertAdjacentHTML') | 1029 @JSName('insertAdjacentHTML') |
1030 void _insertAdjacentHtml(String where, String text) native; | 1030 void _insertAdjacentHtml(String where, String text) native; |
1031 | 1031 |
1032 /** | 1032 /** |
1033 * Inserts [element] into the DOM at the specified location. | 1033 * Inserts [element] into the DOM at the specified location. |
1034 * | 1034 * |
1035 * To see the possible values for [where], read the doc for | 1035 * To see the possible values for [where], read the doc for |
1036 * [insertAdjacentHtml]. | 1036 * [insertAdjacentHtml]. |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 const ScrollAlignment._internal(this._value); | 1577 const ScrollAlignment._internal(this._value); |
1578 toString() => 'ScrollAlignment.$_value'; | 1578 toString() => 'ScrollAlignment.$_value'; |
1579 | 1579 |
1580 /// Attempt to align the element to the top of the scrollable area. | 1580 /// Attempt to align the element to the top of the scrollable area. |
1581 static const TOP = const ScrollAlignment._internal('TOP'); | 1581 static const TOP = const ScrollAlignment._internal('TOP'); |
1582 /// Attempt to center the element in the scrollable area. | 1582 /// Attempt to center the element in the scrollable area. |
1583 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1583 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1584 /// Attempt to align the element to the bottom of the scrollable area. | 1584 /// Attempt to align the element to the bottom of the scrollable area. |
1585 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1585 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1586 } | 1586 } |
OLD | NEW |