File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
- import $ from 'jquery' ;
2
-
3
1
function decodeFragmentValue ( hash ) {
4
2
try {
5
3
return decodeURIComponent ( hash . slice ( 1 ) ) ;
@@ -29,11 +27,17 @@ function hashchange() {
29
27
}
30
28
31
29
export function initialize ( ) {
32
- $ ( window ) . on ( 'hashchange' , hashchange ) ;
30
+ if ( typeof window . addEventListener === 'undefined' ) {
31
+ return ; // Fastboot
32
+ }
33
+ window . addEventListener ( 'hashchange' , hashchange ) ;
33
34
34
35
// If clicking on a link to the same fragment as currently in the address bar,
35
36
// hashchange won't be fired, so we need to manually trigger rescroll.
36
- $ ( document ) . on ( 'a[href]' , 'click' , function ( event ) {
37
+ document . addEventListener ( 'click' , function ( event ) {
38
+ if ( event . target . tagName !== 'A' ) {
39
+ return ;
40
+ }
37
41
if ( this . href === location . href && location . hash . length > 1 ) {
38
42
setTimeout ( function ( ) {
39
43
if ( ! event . defaultPrevented ) {
You can’t perform that action at this time.
0 commit comments