| 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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 if (element.lastChild && | 1446 if (element.lastChild && |
| 1447 element.lastChild !== childNodes[childNodes.length -1]) { | 1447 element.lastChild !== childNodes[childNodes.length -1]) { |
| 1448 return true; | 1448 return true; |
| 1449 } | 1449 } |
| 1450 if (element.children) { // On Safari, children can apparently be null. | 1450 if (element.children) { // On Safari, children can apparently be null. |
| 1451 if (!((element.children instanceof HTMLCollection) || | 1451 if (!((element.children instanceof HTMLCollection) || |
| 1452 (element.children instanceof NodeList))) { | 1452 (element.children instanceof NodeList))) { |
| 1453 return true; | 1453 return true; |
| 1454 } | 1454 } |
| 1455 } | 1455 } |
| 1456 var length = 0; |
| 1457 if (element.children) { |
| 1458 length = element.children.length; |
| 1459 } |
| 1460 for (var i = 0; i < length; i++) { |
| 1461 var child = element.children[i]; |
| 1462 // On IE it seems like we sometimes don't see the clobbered attribute
, |
| 1463 // perhaps as a result of an over-optimization. Also use another rout
e |
| 1464 // to check of attributes, children, or lastChild are clobbered. It m
ay |
| 1465 // seem silly to check children as we rely on children to do this ite
ration, |
| 1466 // but it seems possible that the access to children might see the re
al thing, |
| 1467 // allowing us to check for clobbering that may show up in other acce
sses. |
| 1468 if (child["id"] == 'attributes' || child["name"] == 'attributes' || |
| 1469 child["id"] == 'lastChild' || child["name"] == 'lastChild' || |
| 1470 child["id"] == 'children' || child["name"] == 'children') { |
| 1471 return true; |
| 1472 } |
| 1473 } |
| 1456 return false; | 1474 return false; |
| 1457 })(#)''', element); | 1475 })(#)''', element); |
| 1458 } | 1476 } |
| 1459 $else | 1477 $else |
| 1460 | 1478 |
| 1461 static var _namedNodeMap = js.context["NamedNodeMap"]; | 1479 static var _namedNodeMap = js.context["NamedNodeMap"]; |
| 1462 static var _htmlCollection = js.context["HTMLCollection"]; | 1480 static var _htmlCollection = js.context["HTMLCollection"]; |
| 1463 static var _nodeList = js.context["NodeList"]; | 1481 static var _nodeList = js.context["NodeList"]; |
| 1464 | 1482 |
| 1465 static bool _hasCorruptedAttributes(Element element) { | 1483 static bool _hasCorruptedAttributes(Element element) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1478 if (null != children) { // On Safari, children can apparently be null. | 1496 if (null != children) { // On Safari, children can apparently be null. |
| 1479 if (!children.instanceof(_htmlCollection) || | 1497 if (!children.instanceof(_htmlCollection) || |
| 1480 children.instanceof(_nodeList)) { | 1498 children.instanceof(_nodeList)) { |
| 1481 return true; | 1499 return true; |
| 1482 } | 1500 } |
| 1483 } | 1501 } |
| 1484 return false; | 1502 return false; |
| 1485 } | 1503 } |
| 1486 $endif | 1504 $endif |
| 1487 | 1505 |
| 1488 String get _safeTagName { | 1506 static String _safeTagName(element) { |
| 1489 String result = 'element tag unavailable'; | 1507 String result = 'element tag unavailable'; |
| 1490 try { | 1508 try { |
| 1491 if (tagName is String) { | 1509 if (element.tagName is String) { |
| 1492 result = tagName; | 1510 result = element.tagName; |
| 1493 } | 1511 } |
| 1494 } catch (e) {} | 1512 } catch (e) {} |
| 1495 return result; | 1513 return result; |
| 1496 } | 1514 } |
| 1497 | 1515 |
| 1498 $if DART2JS | 1516 $if DART2JS |
| 1499 @DomName('Element.offsetHeight') | 1517 @DomName('Element.offsetHeight') |
| 1500 @DocsEditable() | 1518 @DocsEditable() |
| 1501 int get offsetHeight => JS('num', '#.offsetHeight', this).round(); | 1519 int get offsetHeight => JS('num', '#.offsetHeight', this).round(); |
| 1502 | 1520 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 const ScrollAlignment._internal(this._value); | 1732 const ScrollAlignment._internal(this._value); |
| 1715 toString() => 'ScrollAlignment.$_value'; | 1733 toString() => 'ScrollAlignment.$_value'; |
| 1716 | 1734 |
| 1717 /// Attempt to align the element to the top of the scrollable area. | 1735 /// Attempt to align the element to the top of the scrollable area. |
| 1718 static const TOP = const ScrollAlignment._internal('TOP'); | 1736 static const TOP = const ScrollAlignment._internal('TOP'); |
| 1719 /// Attempt to center the element in the scrollable area. | 1737 /// Attempt to center the element in the scrollable area. |
| 1720 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1738 static const CENTER = const ScrollAlignment._internal('CENTER'); |
| 1721 /// Attempt to align the element to the bottom of the scrollable area. | 1739 /// Attempt to align the element to the bottom of the scrollable area. |
| 1722 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1740 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
| 1723 } | 1741 } |
| OLD | NEW |