Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

fix: special characters like '/' or ':' or '.' in ID must be escaped for jQuery selector #133

Open
paulgeisler opened this issue Feb 18, 2015 · 1 comment

Comments

@paulgeisler
Copy link

getHash: function($link) {
    var link_content = $link.attr('href').split('#')[1];
    link_content = link_content.replace( /([;&,\.\+\*\~':"\!\^\/#$%@\[\]\(\)=>\|])/g, "\\$1" );
    return link_content;
}
@paulgeisler
Copy link
Author

Oh and you need to remove the escape character ' \ ' before setting the new hash value:

//Do we need to change the hash?
newLoc = newLoc.replace( /(\\)/g, "" );
if(history.replaceState && self.config.changeHash) {
    history.replaceState(null, null, newLoc);
}
else {
    window.location.hash = newLoc;
}

in handleClick and handleScroll functions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant