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

Won't work in Firefox: "SecurityError: The operation is insecure." #10

Closed
lolmaus opened this issue Dec 4, 2013 · 7 comments
Closed

Comments

@lolmaus
Copy link

lolmaus commented Dec 4, 2013

Hi!

Firefox 25.0.1.

elementQuery produces:

SecurityError: The operation is insecure.
http://localhost:4567/javascripts/vendor/elementQuery.js?body=1
Line 19

It works in other browsers.

@lolmaus
Copy link
Author

lolmaus commented Dec 4, 2013

I've managed to locate the problem.

The error happens due to this issue: Firefox not able to enumerate document.styleSheets[].cssRules[] for cross-domain stylesheets.

When i comment out a Google Fonts stylesheet, elementQuery starts working in Firefox.

<link type="text/css" rel="stylesheet" media="screen" href="//fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic&amp;subset=latin,cyrillic-ext,latin-ext,cyrillic">

Please fix this.

@tysonmatanich
Copy link
Owner

Sorry, can't fix as it is the security model that some browsers chose. However, there is a workaround documented; please see "Expanded Support" section of the related Smashing Magazine article.

@lolmaus
Copy link
Author

lolmaus commented Feb 10, 2014

Ain't it possible to make ElementQuery ignore external stylesheets? Make it optional maybe? Tell ElementQuery explicitly which stylesheets to parse?

The issue with Firefox is pretty huge.

@hellolindsay
Copy link

I have found a fix for this -- you can modify the elementQuery.js source code and add a line of code. External stylesheets still wont load, but they will fail elegantly without the error or it's side effects:
http://www.smashingmagazine.com/2013/06/25/media-queries-are-not-the-answer-element-query-polyfill/#comment-1221353

@lolmaus
Copy link
Author

lolmaus commented Aug 21, 2014

Thank you @hellolindsay.

PS Is there a maintained fork of this lib?

@jesseyangjincheng
Copy link

非常感谢!

@lolmaus
Copy link
Author

lolmaus commented Apr 16, 2019

非常感谢!

Всегда пожалуйста!

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

No branches or pull requests

4 participants