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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 if (_parseDocument == null) { | 1334 if (_parseDocument == null) { |
1335 _parseDocument = document.implementation.createHtmlDocument(''); | 1335 _parseDocument = document.implementation.createHtmlDocument(''); |
1336 _parseRange = _parseDocument.createRange(); | 1336 _parseRange = _parseDocument.createRange(); |
1337 | 1337 |
1338 // Workaround for Safari bug. Was also previously Chrome bug 229142 | 1338 // Workaround for Safari bug. Was also previously Chrome bug 229142 |
1339 // - URIs are not resolved in new doc. | 1339 // - URIs are not resolved in new doc. |
1340 BaseElement base = _parseDocument.createElement('base'); | 1340 BaseElement base = _parseDocument.createElement('base'); |
1341 base.href = document.baseUri; | 1341 base.href = document.baseUri; |
1342 _parseDocument.head.append(base); | 1342 _parseDocument.head.append(base); |
1343 } | 1343 } |
| 1344 |
| 1345 // TODO(terry): Fixes Chromium 50 change no body after createHtmlDocument() |
| 1346 if (_parseDocument.body == null) { |
| 1347 _parseDocument.body = _parseDocument.createElement("body"); |
| 1348 } |
| 1349 |
1344 var contextElement; | 1350 var contextElement; |
1345 if (this is BodyElement) { | 1351 if (this is BodyElement) { |
1346 contextElement = _parseDocument.body; | 1352 contextElement = _parseDocument.body; |
1347 } else { | 1353 } else { |
1348 contextElement = _parseDocument.createElement(tagName); | 1354 contextElement = _parseDocument.createElement(tagName); |
1349 _parseDocument.body.append(contextElement); | 1355 _parseDocument.body.append(contextElement); |
1350 } | 1356 } |
1351 var fragment; | 1357 var fragment; |
1352 if (Range.supportsCreateContextualFragment && | 1358 if (Range.supportsCreateContextualFragment && |
1353 _canBeUsedToCreateContextualFragment) { | 1359 _canBeUsedToCreateContextualFragment) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 @DocsEditable() | 1592 @DocsEditable() |
1587 int get scrollWidth => JS('num', '#.scrollWidth', this).round(); | 1593 int get scrollWidth => JS('num', '#.scrollWidth', this).round(); |
1588 | 1594 |
1589 $else | 1595 $else |
1590 // Need to explicitly delegate because Element is no longer abstract for Darti
um. | 1596 // Need to explicitly delegate because Element is no longer abstract for Darti
um. |
1591 bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditab
le_Getter_(this); | 1597 bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditab
le_Getter_(this); |
1592 void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(this); | 1598 void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(this); |
1593 | 1599 |
1594 @DomName('Element.offsetParent') | 1600 @DomName('Element.offsetParent') |
1595 @DocsEditable() | 1601 @DocsEditable() |
1596 Element get offsetParent => _blink.BlinkElement.instance.offsetParent_Getter_(
this); | 1602 Element get offsetParent => _blink.BlinkHTMLElement.instance.offsetParent_Gett
er_(this); |
1597 | 1603 |
1598 @DomName('Element.offsetHeight') | 1604 @DomName('Element.offsetHeight') |
1599 @DocsEditable() | 1605 @DocsEditable() |
1600 int get offsetHeight => _blink.BlinkElement.instance.offsetHeight_Getter_(this
); | 1606 int get offsetHeight => _blink.BlinkHTMLElement.instance.offsetHeight_Getter_(
this); |
1601 | 1607 |
1602 @DomName('Element.offsetLeft') | 1608 @DomName('Element.offsetLeft') |
1603 @DocsEditable() | 1609 @DocsEditable() |
1604 int get offsetLeft => _blink.BlinkElement.instance.offsetLeft_Getter_(this); | 1610 int get offsetLeft => _blink.BlinkHTMLElement.instance.offsetLeft_Getter_(this
); |
1605 | 1611 |
1606 @DomName('Element.offsetTop') | 1612 @DomName('Element.offsetTop') |
1607 @DocsEditable() | 1613 @DocsEditable() |
1608 int get offsetTop => _blink.BlinkElement.instance.offsetTop_Getter_(this); | 1614 int get offsetTop => _blink.BlinkHTMLElement.instance.offsetTop_Getter_(this); |
1609 | 1615 |
1610 @DomName('Element.offsetWidth') | 1616 @DomName('Element.offsetWidth') |
1611 @DocsEditable() | 1617 @DocsEditable() |
1612 int get offsetWidth => _blink.BlinkElement.instance.offsetWidth_Getter_(this); | 1618 int get offsetWidth => _blink.BlinkHTMLElement.instance.offsetWidth_Getter_(th
is); |
1613 | 1619 |
1614 @DomName('Element.scrollHeight') | 1620 @DomName('Element.scrollHeight') |
1615 @DocsEditable() | 1621 @DocsEditable() |
1616 int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(this
).round(); | 1622 int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(this
).round(); |
1617 | 1623 |
1618 @DomName('Element.scrollLeft') | 1624 @DomName('Element.scrollLeft') |
1619 @DocsEditable() | 1625 @DocsEditable() |
1620 int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(this).ro
und(); | 1626 int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(this).ro
und(); |
1621 | 1627 |
1622 @DomName('Element.scrollLeft') | 1628 @DomName('Element.scrollLeft') |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 const ScrollAlignment._internal(this._value); | 1680 const ScrollAlignment._internal(this._value); |
1675 toString() => 'ScrollAlignment.$_value'; | 1681 toString() => 'ScrollAlignment.$_value'; |
1676 | 1682 |
1677 /// Attempt to align the element to the top of the scrollable area. | 1683 /// Attempt to align the element to the top of the scrollable area. |
1678 static const TOP = const ScrollAlignment._internal('TOP'); | 1684 static const TOP = const ScrollAlignment._internal('TOP'); |
1679 /// Attempt to center the element in the scrollable area. | 1685 /// Attempt to center the element in the scrollable area. |
1680 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1686 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1681 /// Attempt to align the element to the bottom of the scrollable area. | 1687 /// Attempt to align the element to the bottom of the scrollable area. |
1682 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1688 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1683 } | 1689 } |
OLD | NEW |