nette-forms-gpspicker icon indicating copy to clipboard operation
nette-forms-gpspicker copied to clipboard

Crossdomain stylesheets

Open nechutny opened this issue 10 years ago • 0 comments

Hello,

when first css style in page is from another domain, then JS fails on:

var stylesheet = window.document.styleSheets[0];
var method = stylesheet.cssRules ? 'insertRule' : 'addRule';
for (var i = 0; i < rules.length; i++) {
    stylesheet[method].call(stylesheet,  rules[i], 0);

because JS in Firefox can't modify cross domain css.

I'm suggesting as solution add this code into loop, try+catch and if try was successful, then break loop. If is caught exception, then do next loop iteration with next styleSheets.

Do you agree with this solution, so I can prepare commit?

nechutny avatar Nov 06 '15 09:11 nechutny