Created by: yuku
The updated line threw a syntax error when an encoded fragment is given.
href = encodeURIComponent('#テスト')
$(href)
// Error: Syntax error, unrecognized expression: %23%E3%83%86%E3%82%B9%E3%83%88
And browsers (at least Chrome 37.0.2062.124 and Firefox 32.0.3) automatically encodes a[href]
values due to rfc3986:
<!-- server response -->
<a href="#テスト"></a>
<div id="テスト"></div>
<!-- browser recognizes as -->
<a href="#%23%E3%83%86%E3%82%B9%E3%83%88"></a>
<div id="テスト"></div>
This means that there is no way to use the plugin with non-ascii hash fragments. This PR fixes the problem.
Patched script works fine on my pages, however, I'm afraid of breaking something important because I'm not familiar with such encoding problems
Thanks.