Closure tweak: variable 'd' declared twice within the same method.
[dygraphs.git] / dygraph-utils.js
index 8c6942b..f53c81e 100644 (file)
@@ -301,6 +301,7 @@ Dygraph.findPosX = function(obj) {
   if(obj.offsetParent) {
     var copyObj = obj;
     while(1) {
+      // NOTE: the if statement here is for IE8.
       var borderLeft = "0";
       if (window.getComputedStyle) {
         borderLeft = window.getComputedStyle(copyObj, null).borderLeft || "0";
@@ -337,6 +338,7 @@ Dygraph.findPosY = function(obj) {
   if(obj.offsetParent) {
     var copyObj = obj;
     while(1) {
+      // NOTE: the if statement here is for IE8.
       var borderTop = "0";
       if (window.getComputedStyle) {
         borderTop = window.getComputedStyle(copyObj, null).borderTop || "0";
@@ -1244,10 +1246,11 @@ Dygraph.isElementContainedBy = function(containee, container) {
   if (container === null || containee === null) {
     return false;
   }
-  while (containee && containee !== container) {
-    containee = containee.parentNode;
+  var containeeNode = /** @type {Node} */ (containee);
+  while (containeeNode && containeeNode !== container) {
+    containeeNode = containeeNode.parentNode;
   }
-  return (containee === container);
+  return (containeeNode === container);
 };