Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "Access Denied" exception on window.frameElement reference in chi…
…ld iframe with document.domain that differs from parent.
- Loading branch information
a5cf129
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "if" block canonicalizes "elem" to the window reference used to initialize jQuery. The new code doesn't bother checking "elem !== window" since the "elem = window" assignment is harmless in the cases where "elem == window".
This is a pretty strange piece of code. To understand it, load any page in IE6, IE7, IE8. Then compare the output of these two URLs when entered in the address bar:
The first URL usually shows "false" in IE and "true" in other browsers. The second URL always shows "true".
I haven't traced back to find out why the original "elem = window" line is necessary. It's older than the 2007 code reorganization that created event.js.
a5cf129
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the original version of the "elem = window" from the initial jQuery import https://github.com/jquery/jquery/blame/329d1a3bb2abf5d64bd2fac5801034757619c950/jquery/jquery.js:
if ( element.location ) element = window; // Ughhhhh....
Here's an intermediate version of it from jquery@9e27d8d:
As far as I can tell, tests pass on IE7 and IE8 (don't have IE6 handy) without that block of code. Does that mean there's no jQuery test that verifies that this IE hack works correctly? Is it even still necessary?