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

Side by Side Diff: runtime/observatory/lib/src/elements/observatory_element.dart

Issue 1034503002: Fix reuse of <ref> elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | « no previous file | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library observatory_element; 5 library observatory_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (wasTruncated) { 157 if (wasTruncated) {
158 result.addAll("...".codeUnits); 158 result.addAll("...".codeUnits);
159 } else { 159 } else {
160 result.add("'".codeUnitAt(0)); 160 result.add("'".codeUnitAt(0));
161 } 161 }
162 return new String.fromCharCodes(result); 162 return new String.fromCharCodes(result);
163 } 163 }
164 164
165 void clearShadowRoot() { 165 void clearShadowRoot() {
166 // Remove all non-style elements. 166 // Remove all non-style elements.
167 shadowRoot.children.removeWhere((e) => e is! StyleElement); 167 // Have to do the following because removeWhere doesn't work on DOM child
168 // node lists. i.e. removeWhere((e) => e is! StyleElement);
169 var styleElements = [];
170 for (var child in shadowRoot.children) {
171 if (child is StyleElement) {
172 styleElements.add(child);
173 }
174 }
175 shadowRoot.children.clear();
176 for (var style in styleElements) {
177 shadowRoot.children.add(style);
178 }
168 } 179 }
169 180
170 void insertTextSpanIntoShadowRoot(String text) { 181 void insertTextSpanIntoShadowRoot(String text) {
171 var spanElement = new SpanElement(); 182 var spanElement = new SpanElement();
172 spanElement.text = text; 183 spanElement.text = text;
173 shadowRoot.children.add(spanElement); 184 shadowRoot.children.add(spanElement);
174 } 185 }
175 186
176 void insertLinkIntoShadowRoot(String label, String href, [String title]) { 187 void insertLinkIntoShadowRoot(String label, String href, [String title]) {
177 var anchorElement = new AnchorElement(); 188 var anchorElement = new AnchorElement();
178 anchorElement.href = href; 189 anchorElement.href = href;
179 anchorElement.text = label; 190 anchorElement.text = label;
180 if (title != null) { 191 if (title != null) {
181 anchorElement.title = title; 192 anchorElement.title = title;
182 } 193 }
183 anchorElement.onClick.listen(onClickGoto); 194 anchorElement.onClick.listen(onClickGoto);
184 shadowRoot.children.add(anchorElement); 195 shadowRoot.children.add(anchorElement);
185 } 196 }
186 } 197 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698