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

Unified Diff: site/try/src/shadow_root.dart

Issue 408783002: Enable Try Dart to run on IE11. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Added 'diagnostic' class to wrapper span, narrowed hover css application Created 6 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 side-by-side diff with in-line comments
Download patch
« site/try/src/settings.dart ('K') | « site/try/src/settings.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: site/try/src/shadow_root.dart
===================================================================
--- site/try/src/shadow_root.dart (revision 38889)
+++ site/try/src/shadow_root.dart (working copy)
@@ -49,6 +49,16 @@
return '$buffer';
}
+/// Element.contains(n) doesn't work when n is node(Text) in IE,
+/// so this is brute-force implementation of contains.
ahe 2014/08/19 09:22:30 so this is *a* ...
aam-me 2014/08/19 12:09:13 Done.
+bool containsNode(parent, child) {
+ var p = child;
ahe 2014/08/19 09:22:30 Indentation.
aam-me 2014/08/19 12:09:13 Done.
+ while (p != null && p != parent) {
+ p = p.parentNode;
+ }
+ return p != null;
+}
+
/// Position [walker] at the last predecessor (that is, child of child of
/// child...) of [node]. The next call to walker.nextNode will return the first
/// node after [node].
@@ -60,7 +70,7 @@
for (Node current = walker.nextNode();
current != null;
current = walker.nextNode()) {
- if (!node.contains(current)) {
+ if (!containsNode(node, current)) {
walker.previousNode();
return;
}
@@ -77,18 +87,19 @@
node is Element &&
node.getAttribute('try-dart-shadow-root') != null) {
skip(node, walker);
+ } else {
+ int action = f(node);
+ switch (action) {
+ case WALKER_RETURN:
+ return;
+ case WALKER_SKIP_NODE:
+ skip(node, walker);
+ break;
+ case WALKER_NEXT:
+ break;
+ default:
+ throw 'Unexpected action returned from [f]: $action';
+ }
}
- int action = f(node);
- switch (action) {
- case WALKER_RETURN:
- return;
- case WALKER_SKIP_NODE:
- skip(node, walker);
- break;
- case WALKER_NEXT:
- break;
- default:
- throw 'Unexpected action returned from [f]: $action';
- }
}
}
« site/try/src/settings.dart ('K') | « site/try/src/settings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698