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

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: Created 6 years, 5 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
Index: site/try/src/shadow_root.dart
===================================================================
--- site/try/src/shadow_root.dart (revision 38416)
+++ 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.
+bool containsNode(parent, child) {
+ var p = child;
+ 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;
}
@@ -92,3 +102,4 @@
}
}
}
+
ahe 2014/07/21 08:16:00 Extra line.
aam-me 2014/07/21 12:20:38 Done.

Powered by Google App Engine
This is Rietveld 408576698