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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 * var createdElement = document.body.children[0]; | 1007 * var createdElement = document.body.children[0]; |
1008 * print(createdElement.classes[0]); // Prints 'something' | 1008 * print(createdElement.classes[0]); // Prints 'something' |
1009 * | 1009 * |
1010 * See also: | 1010 * See also: |
1011 * | 1011 * |
1012 * * [insertAdjacentText] | 1012 * * [insertAdjacentText] |
1013 * * [insertAdjacentElement] | 1013 * * [insertAdjacentElement] |
1014 */ | 1014 */ |
1015 void insertAdjacentHtml(String where, String html, {NodeValidator validator, | 1015 void insertAdjacentHtml(String where, String html, {NodeValidator validator, |
1016 NodeTreeSanitizer treeSanitizer}) { | 1016 NodeTreeSanitizer treeSanitizer}) { |
1017 _insertAdjacentNode(where, new DocumentFragment.html(html, | 1017 if (treeSanitizer is _TrustedHtmlTreeSanitizer) { |
1018 validator: validator, treeSanitizer: treeSanitizer)); | 1018 _insertAdjacentHtml(where, html); |
| 1019 } else { |
| 1020 _insertAdjacentNode(where, new DocumentFragment.html(html, |
| 1021 validator: validator, treeSanitizer: treeSanitizer)); |
| 1022 } |
1019 } | 1023 } |
1020 | 1024 |
1021 $if DART2JS | 1025 $if DART2JS |
1022 | 1026 |
1023 @JSName('insertAdjacentHTML') | 1027 @JSName('insertAdjacentHTML') |
1024 void _insertAdjacentHtml(String where, String text) native; | 1028 void _insertAdjacentHtml(String where, String text) native; |
1025 | 1029 |
1026 /** | 1030 /** |
1027 * Inserts [element] into the DOM at the specified location. | 1031 * Inserts [element] into the DOM at the specified location. |
1028 * | 1032 * |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 * are allowed by the provided validator. | 1371 * are allowed by the provided validator. |
1368 * | 1372 * |
1369 * See also: | 1373 * See also: |
1370 * | 1374 * |
1371 * * [NodeValidator] | 1375 * * [NodeValidator] |
1372 * * [NodeTreeSanitizer] | 1376 * * [NodeTreeSanitizer] |
1373 */ | 1377 */ |
1374 void setInnerHtml(String html, | 1378 void setInnerHtml(String html, |
1375 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { | 1379 {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) { |
1376 text = null; | 1380 text = null; |
1377 append(createFragment( | 1381 if (treeSanitizer is _TrustedHtmlTreeSanitizer) { |
1378 html, validator: validator, treeSanitizer: treeSanitizer)); | 1382 _innerHtml = html; |
| 1383 } else { |
| 1384 append(createFragment( |
| 1385 html, validator: validator, treeSanitizer: treeSanitizer)); |
| 1386 } |
1379 } | 1387 } |
1380 String get innerHtml => _innerHtml; | 1388 String get innerHtml => _innerHtml; |
1381 | 1389 |
1382 /** | 1390 /** |
1383 * This is an ease-of-use accessor for event streams which should only be | 1391 * This is an ease-of-use accessor for event streams which should only be |
1384 * used when an explicit accessor is not available. | 1392 * used when an explicit accessor is not available. |
1385 */ | 1393 */ |
1386 ElementEvents get on => new ElementEvents(this); | 1394 ElementEvents get on => new ElementEvents(this); |
1387 | 1395 |
1388 /** | 1396 /** |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 const ScrollAlignment._internal(this._value); | 1582 const ScrollAlignment._internal(this._value); |
1575 toString() => 'ScrollAlignment.$_value'; | 1583 toString() => 'ScrollAlignment.$_value'; |
1576 | 1584 |
1577 /// Attempt to align the element to the top of the scrollable area. | 1585 /// Attempt to align the element to the top of the scrollable area. |
1578 static const TOP = const ScrollAlignment._internal('TOP'); | 1586 static const TOP = const ScrollAlignment._internal('TOP'); |
1579 /// Attempt to center the element in the scrollable area. | 1587 /// Attempt to center the element in the scrollable area. |
1580 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1588 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1581 /// Attempt to align the element to the bottom of the scrollable area. | 1589 /// Attempt to align the element to the bottom of the scrollable area. |
1582 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1590 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1583 } | 1591 } |
OLD | NEW |