File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 34
34
}
35
35
}
36
36
37
- function escapeCharacters ( hash ) {
37
+ function parseRawHash ( hash ) {
38
38
// Remove leading hash
39
39
if ( hash . charAt ( 0 ) === '#' ) {
40
40
hash = hash . substr ( 1 )
41
41
}
42
42
43
- return '#' + CSS . escape ( hash )
43
+ // Escape characthers
44
+ try {
45
+ hash = decodeURIComponent ( hash )
46
+ } catch ( e ) { }
47
+ return CSS . escape ( hash )
44
48
}
45
49
46
50
function initLocationHashFuzzyMatching ( ) {
47
51
var rawHash = window . location . hash
48
52
if ( ! rawHash ) return
49
- var hash
50
- try {
51
- hash = escapeCharacters ( decodeURIComponent ( rawHash ) )
52
- } catch ( e ) {
53
- hash = escapeCharacters ( rawHash )
54
- }
53
+ var hash = parseRawHash ( rawHash )
55
54
var hashTarget = document . getElementById ( hash )
56
55
if ( ! hashTarget ) {
57
56
var normalizedHash = normalizeHash ( hash )
64
63
if ( distanceA > distanceB ) return 1
65
64
return 0
66
65
} )
67
- window . location . hash = possibleHashes [ 0 ]
66
+ window . location . hash = '#' + possibleHashes [ 0 ]
68
67
}
69
68
70
69
function normalizeHash ( rawHash ) {
You can’t perform that action at this time.
0 commit comments