Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust array type check for cross-frame support #1279

Merged
merged 1 commit into from
Jan 14, 2013
Merged

Robust array type check for cross-frame support #1279

merged 1 commit into from
Jan 14, 2013

Conversation

oslek
Copy link
Contributor

@oslek oslek commented Jan 14, 2013

In a multi-frame DOM environment, if setView is called with an array for
the first parameter, a subsequent call to getBounds raises "Invalid
LatLng object" exception. This is the case if the array passed to
setView was created outside the iFrame that contains the map. It causes
the array test using "instanceof" in L.latLng to fail, and
_initialTopLeftPoint to not being properly initialized.

Thank you to Juriy Zaytsev for the full explaination:
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
John Resig and Dean Edwards post comments and concur.

In a multi-frame DOM environment, if setView is called with an array for
the first parameter, a subsequent call to getBounds raises "Invalid
LatLng object" exception. This is the case if the array passed to
setView was created outside the iFrame that contains the map. It causes
the array test using "instanceof" in L.latLng to fail, and
_initialTopLeftPoint to not being properly initialized.

Thank you to Juriy Zaytsev for the full explaination:
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
John Resig and Dean Edwards post comments and concur.
mourner added a commit that referenced this pull request Jan 14, 2013
Robust array type check for cross-frame support
@mourner mourner merged commit 405bf0c into Leaflet:master Jan 14, 2013
@mourner
Copy link
Member

mourner commented Jan 14, 2013

Sounds reasonable, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants