-
Notifications
You must be signed in to change notification settings - Fork 379
Only process hashtags if enabled in options #432
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
Conversation
Actually that change only prevents setting up the hash tag regex. Line 636 is the line that prevents processing hashtags if the option is disabled. if (o.hashTags) { base.setHash(page); } So, I'm not sure why this change is necessary? Is there a bug? |
It's related to issue #413: Anythingslider breaking with an equal in the hash. This commit is a bandaid that helped me get AnythingSlider working in my particular context. Even with The code I committed fixed the error, but there is probably a better way to correctly fix the problem. I'm not sure what specifically in that is causing issues with #!, and that root issue should probably be looked at. My guess would be that AnythingSlider is evaluating the hashtags (even when they are disabled) and choking on non-alphanumeric characters in the hashtags before it even gets to Line 636. |
Ok, thanks for the update. I'll look into this a bit more, but I most likely won't use the changes in this pull request as it breaks the functionality of the |
Thanks for checking into it! No worries about using this pull request. It fixed the error for me, but I didn't test it with hashes enabled since I don't use that functionality. |
Could you please verify that the latest version doesn't have this issue. Thanks! |
Issue appears to be resolved with the latest version. Thanks! |
There is still a bug in this. Try going to #!demo/slider and jQuery will crash because the selector is invalid. The regex test on line 716 should be Also you might want to check if the selector is even valid since it is arbitrary passed in by the end user. You can escape the selector so it is valid according to web standards: "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")." So something like this will work: selector = selector.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); |
Something's still wacky going on. Shouldn't hashTag: false go around all this? I can't use the slider with http://canjs.us. |
That was my initial thought. Contain all of the hash tag processing with |
Hmm, well I left in the ability to pass a hash tag to a page (e.g. simple.html#&panel1-3) to set the slide ignoring the hash tag setting. If you think it's a better idea to disable it completely, I can update the plugin. |
I believe it should be left out completely if hashTag is off because it will conflict will all JavaScript history routers (jQuery-BBQ, jQuery Mobile, CanJS, Backbone, etc). AnythingSlider will keep trying to interpret stuff that history routers are setting which is not intended. If someone wants to change the slider to a certain panel, they can either enable hashTags in AnythingSlider, or disable hashTag and change the slider through the API manually. |
Ok, I just updated the repo to version 1.8.8. The hash will now be completely ignored if |
Awesome works great! Thanks!!! |
Only process hashtags if enabled in options, ensuring compatibility with other scripts using hashtags with the option
hashTags : false