DOMException SecurityError (code 18) checkIfStyleSheetIsImported
See original GitHub issuereact-vis/es/utils/react-utils@checkIfStyleSheetIsImported
checking of importing of react-vis styles via var CSSRulesList = styleSheet.rules || styleSheet.cssRules
it’s better to check via document.styleSheets[i].hasOwnProperty(‘rules’) and document.styleSheets[i].hasOwnProperty(‘cssRules’)
otherwise, the DOMException https://developer.mozilla.org/en-US/docs/Web/API/DOMException SecurityError (code 18) would be in CHROME (windows 10, Version 64.0.3282.167 (Official Build) (64-bit)) if there will be any of <link/> or <style/> tags appended to <head> by other plugins do not have this properties (like, in my case, was https://github.com/tomchentw/react-google-maps, that append to <head> google-fonts <link/>)
for now if fixed it via changing prototype of component where it was used
XYPlot.prototype.componentDidMount = function () { try { checkIfStyleSheetIsImported() } catch (err) { console.warn(err) console.warn('most likely the problem is because of accessing document.styleSheets[i].rules or document.styleSheets[i].cssRules') console.warn('the right way is, e.g., document.styleSheets[i].hasOwnProperty("rules")') } }
but it would be better if you change the react-vis/es/utils/react-utils@checkIfStyleSheetIsImported
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Hi!
Year, sure!
but very busy right now 😦
I think i’ll make the PR at this holidays
– Vasil Zchdankin6
@JFernandoGomez I’m going to publish a new version today.