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

Side by Side Diff: client/html/src/ElementWrappingImplementation.dart

Issue 8835006: New version of dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typos Created 9 years 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. 5 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality.
6 class _ChildrenElementList implements ElementList { 6 class _ChildrenElementList implements ElementList {
7 // Raw Element. 7 // Raw Element.
8 final _element; 8 final _element;
9 final _childElements; 9 final _childElements;
10 10
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // 4) Detatch the created element from its dummy parent. 511 // 4) Detatch the created element from its dummy parent.
512 String parentTag = 'div'; 512 String parentTag = 'div';
513 String tag; 513 String tag;
514 final match = _START_TAG_REGEXP.firstMatch(html); 514 final match = _START_TAG_REGEXP.firstMatch(html);
515 if (match !== null) { 515 if (match !== null) {
516 tag = match.group(1).toLowerCase(); 516 tag = match.group(1).toLowerCase();
517 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { 517 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) {
518 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; 518 parentTag = _CUSTOM_PARENT_TAG_MAP[tag];
519 } 519 }
520 } 520 }
521 final temp = dom.document.createElement(parentTag); 521 dom.HTMLElement temp = dom.document.createElement(parentTag);
522 temp.innerHTML = html; 522 temp.innerHTML = html;
523 523
524 if (temp.childElementCount == 1) { 524 if (temp.childElementCount == 1) {
525 return LevelDom.wrapElement(temp.firstElementChild); 525 return LevelDom.wrapElement(temp.firstElementChild);
526 } else if (parentTag == 'html' && temp.childElementCount == 2) { 526 } else if (parentTag == 'html' && temp.childElementCount == 2) {
527 // Work around for edge case in WebKit and possibly other browsers where 527 // Work around for edge case in WebKit and possibly other browsers where
528 // both body and head elements are created even though the inner html 528 // both body and head elements are created even though the inner html
529 // only contains a head or body element. 529 // only contains a head or body element.
530 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1)); 530 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
531 } else { 531 } else {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 new Completer<CSSStyleDeclaration>()); 741 new Completer<CSSStyleDeclaration>());
742 } 742 }
743 743
744 ElementEvents get on() { 744 ElementEvents get on() {
745 if (_on === null) { 745 if (_on === null) {
746 _on = new ElementEventsImplementation._wrap(_ptr); 746 _on = new ElementEventsImplementation._wrap(_ptr);
747 } 747 }
748 return _on; 748 return _on;
749 } 749 }
750 } 750 }
OLDNEW
« no previous file with comments | « client/html/src/DocumentWrappingImplementation.dart ('k') | client/html/src/GlobalProperties.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698