Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 1369573004: Move JS calls out of Dartium code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/dom/src/Validators.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 // allowing us to check for clobbering that may show up in other acce sses. 1467 // allowing us to check for clobbering that may show up in other acce sses.
1468 if (child["id"] == 'attributes' || child["name"] == 'attributes' || 1468 if (child["id"] == 'attributes' || child["name"] == 'attributes' ||
1469 child["id"] == 'lastChild' || child["name"] == 'lastChild' || 1469 child["id"] == 'lastChild' || child["name"] == 'lastChild' ||
1470 child["id"] == 'children' || child["name"] == 'children') { 1470 child["id"] == 'children' || child["name"] == 'children') {
1471 return true; 1471 return true;
1472 } 1472 }
1473 } 1473 }
1474 return false; 1474 return false;
1475 })(#)''', element); 1475 })(#)''', element);
1476 } 1476 }
1477
1478 /// A secondary check for corruption, needed on IE
1479 static bool _hasCorruptedAttributesAdditionalCheck(Element element) {
1480 return JS('bool', r'!(#.attributes instanceof NamedNodeMap)', element);
1481 }
1477 $else 1482 $else
1478 1483
1479 static var _namedNodeMap = js.context["NamedNodeMap"]; 1484 static var _namedNodeMap = js.context["NamedNodeMap"];
1480 static var _htmlCollection = js.context["HTMLCollection"]; 1485 static var _htmlCollection = js.context["HTMLCollection"];
1481 static var _nodeList = js.context["NodeList"]; 1486 static var _nodeList = js.context["NodeList"];
1482 1487
1483 static bool _hasCorruptedAttributes(Element element) { 1488 static bool _hasCorruptedAttributes(Element element) {
1484 var attributes = unwrap_jso(element)["attributes"]; 1489 var attributes = unwrap_jso(element)["attributes"];
1485 if (!attributes.instanceof(_namedNodeMap)) { 1490 if (!attributes.instanceof(_namedNodeMap)) {
1486 return true; 1491 return true;
1487 } 1492 }
1488 var childNodes = unwrap_jso(element.childNodes); 1493 var childNodes = unwrap_jso(element.childNodes);
1489 var length = childNodes["length"]; 1494 var length = childNodes["length"];
1490 var lastChild = unwrap_jso(element.lastChild); 1495 var lastChild = unwrap_jso(element.lastChild);
1491 if (null != lastChild && 1496 if (null != lastChild &&
1492 lastChild != childNodes[length - 1]) { 1497 lastChild != childNodes[length - 1]) {
1493 return true; 1498 return true;
1494 } 1499 }
1495 var children = unwrap_jso(element._children); 1500 var children = unwrap_jso(element._children);
1496 if (null != children) { // On Safari, children can apparently be null. 1501 if (null != children) { // On Safari, children can apparently be null.
1497 if (!children.instanceof(_htmlCollection) || 1502 if (!children.instanceof(_htmlCollection) ||
1498 children.instanceof(_nodeList)) { 1503 children.instanceof(_nodeList)) {
1499 return true; 1504 return true;
1500 } 1505 }
1501 } 1506 }
1502 return false; 1507 return false;
1503 } 1508 }
1509
1510 /// A secondary check for corruption, needed on IE
1511 static bool _hasCorruptedAttributesAdditionalCheck(Element element) => false;
1504 $endif 1512 $endif
1505 1513
1506 static String _safeTagName(element) { 1514 static String _safeTagName(element) {
1507 String result = 'element tag unavailable'; 1515 String result = 'element tag unavailable';
1508 try { 1516 try {
1509 if (element.tagName is String) { 1517 if (element.tagName is String) {
1510 result = element.tagName; 1518 result = element.tagName;
1511 } 1519 }
1512 } catch (e) {} 1520 } catch (e) {}
1513 return result; 1521 return result;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 const ScrollAlignment._internal(this._value); 1740 const ScrollAlignment._internal(this._value);
1733 toString() => 'ScrollAlignment.$_value'; 1741 toString() => 'ScrollAlignment.$_value';
1734 1742
1735 /// Attempt to align the element to the top of the scrollable area. 1743 /// Attempt to align the element to the top of the scrollable area.
1736 static const TOP = const ScrollAlignment._internal('TOP'); 1744 static const TOP = const ScrollAlignment._internal('TOP');
1737 /// Attempt to center the element in the scrollable area. 1745 /// Attempt to center the element in the scrollable area.
1738 static const CENTER = const ScrollAlignment._internal('CENTER'); 1746 static const CENTER = const ScrollAlignment._internal('CENTER');
1739 /// Attempt to align the element to the bottom of the scrollable area. 1747 /// Attempt to align the element to the bottom of the scrollable area.
1740 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1748 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1741 } 1749 }
OLDNEW
« no previous file with comments | « tools/dom/src/Validators.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698