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

Add cssRule #201

Closed
henkeklein opened this issue Mar 28, 2018 · 10 comments
Closed

Add cssRule #201

henkeklein opened this issue Mar 28, 2018 · 10 comments

Comments

@henkeklein
Copy link

Error: Failed to execute 'insertRule' on 'CSSStyleSheet in Chrome v65.
Issue in ui-scroll.js: funtion addCSSRule

Solution: Simply surround with try/ catch?

@dhilt
Copy link
Member

dhilt commented Mar 28, 2018

@henkeklein Thanks for the issue!

I tried to run different demos with angular-ui-scroll v1.7.0 on Chrome v65.0.3325.181 and didn't see any issues with CSSStyleSheet.insertRule. This method is being called on the app start by the addCSSRule function execution (elementRoutines.js) and works fine for me.

What version of the ui-scroll are you using? what OS? What is the full error message? How many scroller instances do you have on the page that fails with that error? Maybe you can provide a runnable repro?

Also, this topic may be helpful...

@henkeklein
Copy link
Author

So just saw that I am using v1.6.2 so maybe the problem will disappear just upgrading.

I have only 1 instances on the page egen is fails. Thanka for the advice!

@dhilt
Copy link
Member

dhilt commented Apr 1, 2018

@henkeklein I believe, addCSSRule method appeared after v1.6.2, so it's weird... Anyway we need more details to continue (OS and full error log) or/and repro.

@PabloMR92
Copy link

I'm having the exact same problem on Windows x64. Chrome (Versión 65.0.3325.181). The error only appears occasionally, after I transition from another state (it does not happen when I hit F5 to refresh the page).
With only 1 ui-scroll on the screen, this is the console error:

index.js:56814 DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Cannot access StyleSheet to insertRule
at addCSSRule (https://localhost:3010/index.js:159918:15)
at new ElementRoutines (https://localhost:3010/index.js:159931:9)
at Object.link (https://localhost:3010/index.js:159062:31)
at https://localhost:3010/index.js:43499:18
at invokeLinkFn (https://localhost:3010/index.js:52659:9)
at nodeLinkFn (https://localhost:3010/index.js:52048:11)
at compositeLinkFn (https://localhost:3010/index.js:51288:13)
at nodeLinkFn (https://localhost:3010/index.js:52042:11)
at compositeLinkFn (https://localhost:3010/index.js:51288:13)
at compositeLinkFn (https://localhost:3010/index.js:51291:13) ""

I'm currently using the 1.7.0 version of ui-scroll. As a dirty fix I've just added

'.ng-ui-scroll-hide {
  display: none;
}'

To one of my stylesheets, while commenting the call to addCSSRule:

function ElementRoutines($injector, $q) {
        _classCallCheck(this, ElementRoutines);

        this.$animate = $injector.has && $injector.has('$animate') ? $injector.get('$animate') : null;
        this.isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;
        this.$q = $q;
        // addCSSRule(document.styleSheets[0], '.' + hideClassToken, 'display: none');
      }

@dhilt
Copy link
Member

dhilt commented Apr 12, 2018

@PabloMR92 Thanks for the details! If the bug appears only during state transitions (ui-router?) and does not appear on the App start, then I know how I will fix it. @henkeklein Can you confirm that you don't see the issue right after the App start too?

@henkeklein
Copy link
Author

Exactly, it does not appear on App start only after state transitions.

@dhilt
Copy link
Member

dhilt commented Apr 13, 2018

Okay! Here's the Pull Request with the issue fix: Add css rules on the App start.
@henkeklein @PabloMR92 May I ask you to try the updated distributive before merging it to 'master'? Does it solve the problem?
Thanks!

@PabloMR92
Copy link

Works like a charm, thank you very much!

@dhilt
Copy link
Member

dhilt commented Apr 13, 2018

v1.7.1 has just been released, and soon it will be available via npm.
Thanks!

@dhilt dhilt closed this as completed Apr 13, 2018
@henkeklein
Copy link
Author

Thanks a lot, problem solved :)!

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

3 participants