| 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 // TODO(jacobr): use _Lists.dart to remove some of the duplicated | 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated |
| 8 // functionality. | 8 // functionality. |
| 9 class _ChildrenElementList implements List { | 9 class _ChildrenElementList implements List { |
| 10 // Raw Element. | 10 // Raw Element. |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 } | 1026 } |
| 1027 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; | 1027 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; |
| 1028 if (parentTag == null) parentTag = 'div'; | 1028 if (parentTag == null) parentTag = 'div'; |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 final temp = new Element.tag(parentTag); | 1031 final temp = new Element.tag(parentTag); |
| 1032 temp.innerHtml = html; | 1032 temp.innerHtml = html; |
| 1033 | 1033 |
| 1034 Element element; | 1034 Element element; |
| 1035 if (temp.children.length == 1) { | 1035 if (temp.children.length == 1) { |
| 1036 element = temp.children[0]; | 1036 element = temp.$dom_firstChild; |
| 1037 } else if (parentTag == 'html' && temp.children.length == 2) { | 1037 } else if (parentTag == 'html' && temp.children.length == 2) { |
| 1038 // In html5 the root <html> tag will always have a <body> and a <head>, | 1038 // In html5 the root <html> tag will always have a <body> and a <head>, |
| 1039 // even though the inner html only contains one of them. | 1039 // even though the inner html only contains one of them. |
| 1040 element = temp.children[tag == 'head' ? 0 : 1]; | 1040 element = temp.children[tag == 'head' ? 0 : 1]; |
| 1041 } else { | 1041 } else { |
| 1042 // Throw an exception because too many children. |
| 1042 _singleNode(temp.children); | 1043 _singleNode(temp.children); |
| 1043 } | 1044 } |
| 1044 element.remove(); | 1045 element.remove(); |
| 1045 return element; | 1046 return element; |
| 1046 } | 1047 } |
| 1047 | 1048 |
| 1048 /** | 1049 /** |
| 1049 * IE table elements don't support innerHTML (even in standards mode). | 1050 * IE table elements don't support innerHTML (even in standards mode). |
| 1050 * Instead we use a div and inject the table element in the innerHtml string. | 1051 * Instead we use a div and inject the table element in the innerHtml string. |
| 1051 * This technique works on other browsers too, but it's probably slower, | 1052 * This technique works on other browsers too, but it's probably slower, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 const ScrollAlignment._internal(this._value); | 1128 const ScrollAlignment._internal(this._value); |
| 1128 toString() => 'ScrollAlignment.$_value'; | 1129 toString() => 'ScrollAlignment.$_value'; |
| 1129 | 1130 |
| 1130 /// Attempt to align the element to the top of the scrollable area. | 1131 /// Attempt to align the element to the top of the scrollable area. |
| 1131 static const TOP = const ScrollAlignment._internal('TOP'); | 1132 static const TOP = const ScrollAlignment._internal('TOP'); |
| 1132 /// Attempt to center the element in the scrollable area. | 1133 /// Attempt to center the element in the scrollable area. |
| 1133 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1134 static const CENTER = const ScrollAlignment._internal('CENTER'); |
| 1134 /// Attempt to align the element to the bottom of the scrollable area. | 1135 /// Attempt to align the element to the bottom of the scrollable area. |
| 1135 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1136 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
| 1136 } | 1137 } |
| OLD | NEW |