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

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

Issue 22967006: Adding polyfill support for custom elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/dom/templates/html/impl/impl_Document.darttemplate ('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 // Raw Element. 8 // Raw Element.
9 final Element _element; 9 final Element _element;
10 final HtmlCollection _childElements; 10 final HtmlCollection _childElements;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 * border + margin box in this list. 237 * border + margin box in this list.
238 * 238 *
239 * This returns a rectangle with the dimenions actually available for content 239 * This returns a rectangle with the dimenions actually available for content
240 * in this element, in pixels, regardless of this element's box-sizing 240 * in this element, in pixels, regardless of this element's box-sizing
241 * property. Unlike [getBoundingClientRect], the dimensions of this rectangle 241 * property. Unlike [getBoundingClientRect], the dimensions of this rectangle
242 * will return the same numerical height if the element is hidden or not. This 242 * will return the same numerical height if the element is hidden or not. This
243 * can be used to retrieve jQuery's `outerHeight` value for an element. 243 * can be used to retrieve jQuery's `outerHeight` value for an element.
244 */ 244 */
245 @Experimental() 245 @Experimental()
246 CssRect get marginEdge; 246 CssRect get marginEdge;
247 $!STREAM_GETTER_SIGNATURES 247 $!STREAM_GETTER_SIGNATURES
248 } 248 }
249 249
250 // TODO(jacobr): this is an inefficient implementation but it is hard to see 250 // TODO(jacobr): this is an inefficient implementation but it is hard to see
251 // a better option given that we cannot quite force NodeList to be an 251 // a better option given that we cannot quite force NodeList to be an
252 // ElementList as there are valid cases where a NodeList JavaScript object 252 // ElementList as there are valid cases where a NodeList JavaScript object
253 // contains Node objects that are not Elements. 253 // contains Node objects that are not Elements.
254 class _FrozenElementList<T extends Element> extends ListBase<T> implements Eleme ntList { 254 class _FrozenElementList<T extends Element> extends ListBase<T> implements Eleme ntList {
255 final List<Node> _nodeList; 255 final List<Node> _nodeList;
256 // The subset of _nodeList that are Elements. 256 // The subset of _nodeList that are Elements.
257 List<Element> _elementList; 257 List<Element> _elementList;
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 bool foundAsParent = identical(current, parent) || parent.tagName == 'HTML'; 1163 bool foundAsParent = identical(current, parent) || parent.tagName == 'HTML';
1164 if (current == null || identical(current, parent)) { 1164 if (current == null || identical(current, parent)) {
1165 if (foundAsParent) return new Point(0, 0); 1165 if (foundAsParent) return new Point(0, 0);
1166 throw new ArgumentError("Specified element is not a transitive offset " 1166 throw new ArgumentError("Specified element is not a transitive offset "
1167 "parent of this element."); 1167 "parent of this element.");
1168 } 1168 }
1169 Element parentOffset = current.offsetParent; 1169 Element parentOffset = current.offsetParent;
1170 Point p = Element._offsetToHelper(parentOffset, parent); 1170 Point p = Element._offsetToHelper(parentOffset, parent);
1171 return new Point(p.x + current.offsetLeft, p.y + current.offsetTop); 1171 return new Point(p.x + current.offsetLeft, p.y + current.offsetTop);
1172 } 1172 }
1173
1174 $if DART2JS
1175 @JSName('innerHTML')
1176 @DomName('HTMLElement.innerHTML')
1177 String get innerHtml;
1178
1179 void set innerHtml(String value) {
1180 JS('', '#.innerHTML = #', this, value);
1181 // Polyfill relies on mutation observers for upgrading, but we want it
1182 // immediate.
1183 Platform.upgradeCustomElements(this);
1184 }
1185 $endif
1186
1173 $!MEMBERS 1187 $!MEMBERS
1174 } 1188 }
1175 1189
1176 final _START_TAG_REGEXP = new RegExp('<(\\w+)'); 1190 final _START_TAG_REGEXP = new RegExp('<(\\w+)');
1177 class _ElementFactoryProvider { 1191 class _ElementFactoryProvider {
1178 static const _CUSTOM_PARENT_TAG_MAP = const { 1192 static const _CUSTOM_PARENT_TAG_MAP = const {
1179 'body' : 'html', 1193 'body' : 'html',
1180 'head' : 'html', 1194 'head' : 'html',
1181 'caption' : 'table', 1195 'caption' : 'table',
1182 'td': 'tr', 1196 'td': 'tr',
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 const ScrollAlignment._internal(this._value); 1323 const ScrollAlignment._internal(this._value);
1310 toString() => 'ScrollAlignment.$_value'; 1324 toString() => 'ScrollAlignment.$_value';
1311 1325
1312 /// Attempt to align the element to the top of the scrollable area. 1326 /// Attempt to align the element to the top of the scrollable area.
1313 static const TOP = const ScrollAlignment._internal('TOP'); 1327 static const TOP = const ScrollAlignment._internal('TOP');
1314 /// Attempt to center the element in the scrollable area. 1328 /// Attempt to center the element in the scrollable area.
1315 static const CENTER = const ScrollAlignment._internal('CENTER'); 1329 static const CENTER = const ScrollAlignment._internal('CENTER');
1316 /// Attempt to align the element to the bottom of the scrollable area. 1330 /// Attempt to align the element to the bottom of the scrollable area.
1317 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1331 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1318 } 1332 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Document.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698