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

Fix styles not being injected due to location including full url including arguments #36

Closed
wants to merge 1 commit into from

Conversation

k3mist
Copy link

@k3mist k3mist commented Oct 19, 2017

This fixes #34

I added some console logging to the script.js file to see what was going on.

The issue was m.location appears to include the url arguments on occasion which causes a mismatch between m.location and dl.href since dl.href was not including these arguments.

I'm not sure if dl.href would ever also include the url arguments but just incase I've also filtered that as well.

I guess if for some reason there would be the want or need to match url arguments in this method instead of just the base url. Then obviously this would cause issues with that.

screen shot 2017-10-19 at 5 56 22 pm

@350d
Copy link
Owner

350d commented Oct 20, 2017

In script.js I have ping('getStyles', dl.href) to request available styles from global.js for current page address (d.href contains full address and not just a base url). global.js sends back exactly the same address in m.location. So, there is no need to split and check base url, it can break style triggers (urls and urlprefixes). If you working on style and your style should work on url with any parameters - use url prefixes in your style editor and not just urls.

@k3mist
Copy link
Author

k3mist commented Oct 20, 2017

That make sense. So if I understand you correctly its the styles themselves that need updated to use a regex that accepts/ignores parameters in the urls?

I only wonder what changed that this is now an issue. I am still a little confused as to why setting domain to reddit.com as a matcher doesn't seem to work all the time. I would assume it should ignore everything but the domain name which the styles I've tested are using that as the matcher.

What I was seeing when I added logging output is m.location including the url with full arguments and dl.href is not which I included in the screenshot above. So when the inject is to take place it was comparing those two parameters and when they did not match, regardless or not if the style was using domain, it would not apply the style.

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.

stylish intermittently stops applying to links opened to new tabs in Safari 11
2 participants