victormaiam / jqueryjs

Automatically exported from code.google.com/p/jqueryjs
0 stars 0 forks source link

Checking object constructors for equality with "Array" function is inaccurate #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create code on a page that uses a jQuery API whose behavior varies based
on whether a parameter is an array
2. Create an iframe in that page and load it with another page
3. From the other page, use "parent" to invoke the function from step 1
with an array.  Note that the function behaves as if the parameter is *not*
an array.

What is the expected output? What do you see instead?

A legitimate red-blooded array constructed on a page should be treated as
an array by jQuery code called on any other page reachable through the DOM.
 Things are just weird if it doesn't. 

What version of the product are you using? On what operating system?

1.2.1 and the problem occurs on both Firefox and IE.

Please provide any additional information below.

There is a separate instance of the "Array" constructor in the global
context ("window") for every page.  Thus, checking to see if the
"constructor" property of an object is equal to the function referenced by
the "global" variable called "Array" will fail for arrays constructed on a
different page.

(The same holds true of course for any other built-in type, but Array
causes the most problems.)

The use of nested iframes within an application has its adherents and
detractors, but it's not improper or "wrong".  Seems to me that the
framework should either handle the situation properly or else explicitly
fail in some direct way.

See http://gutfullofbeer.net/arrays/a.html for an elementary illustration
(which does not involve any jQuery code). 

Original issue reported on code.google.com by m...@io.com on 8 Dec 2007 at 9:00

GoogleCodeExporter commented 9 years ago
Thank you for writing up this problem.  Unfortunately we use a different bug 
tracking system at http://dev.jquery.com/ so this issue was just noticed.  In 
the 
future, please use that system for tracking issues.  We are going to check the 
current google issues and then close this issue database to help stop any 
confusion 
about which to use.

This issue has been moved to a ticket here:

http://dev.jquery.com/ticket/2152

Thanks.

Original comment by davidser...@gmail.com on 11 Jan 2008 at 6:37