[OpenLayers-Commits] r12097 - trunk/openlayers/tests

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Jun 17 09:16:54 EDT 2011


Author: tschaub
Date: 2011-06-17 06:16:53 -0700 (Fri, 17 Jun 2011)
New Revision: 12097

Modified:
   trunk/openlayers/tests/Util.html
Log:
Demonstrate that instanceof doesn't work for arrays created in another frame.

Modified: trunk/openlayers/tests/Util.html
===================================================================
--- trunk/openlayers/tests/Util.html	2011-06-16 20:12:13 UTC (rev 12096)
+++ trunk/openlayers/tests/Util.html	2011-06-17 13:16:53 UTC (rev 12097)
@@ -63,6 +63,20 @@
              "isArray reports new Array() is an Array");
     }
     
+    function test_iframe_isArray(t) {
+        t.plan(3);
+        // create an array in an iframe
+        var iframe = document.createElement("iframe");
+        document.body.appendChild(iframe);
+        frames[frames.length-1].document.write(
+            "<script>parent.testArray = [];<\/script>"
+        );
+        
+        t.ok(!!testArray, "testArray created");
+        t.ok(!(testArray instanceof Array), "instanceof check doesn't work");
+        t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works");
+    }
+    
     function test_$(t) {
         t.plan(1);
         t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");



More information about the Commits mailing list