Chromium Code Reviews| 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.
|