File tree 2 files changed +17
-6
lines changed
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
5
5
import ArrayProxy from '@ember/array/proxy' ;
6
6
import { computed , observer } from '@ember/object' ;
7
7
import { later } from '@ember/runloop' ;
8
- import $ from 'jquery' ;
9
8
import moment from 'moment' ;
10
9
11
10
const NUM_VERSIONS = 5 ;
@@ -185,6 +184,13 @@ export default Controller.extend({
185
184
} ,
186
185
187
186
report : observer ( 'crate.readme' , function ( ) {
188
- setTimeout ( ( ) => $ ( window ) . trigger ( 'hashchange' ) ) ;
187
+ if ( typeof document === 'undefined' ) {
188
+ return ;
189
+ }
190
+ setTimeout ( ( ) => {
191
+ let e = document . createEvent ( 'CustomEvent' ) ;
192
+ e . initCustomEvent ( 'hashchange' , true , true ) ;
193
+ window . dispatchEvent ( e ) ;
194
+ } ) ;
189
195
} ) ,
190
196
} ) ;
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,18 @@ function hashchange() {
29
27
}
30
28
31
29
export function initialize ( ) {
32
- $ ( window ) . on ( 'hashchange' , hashchange ) ;
30
+ if ( typeof window === 'undefined' || typeof window . addEventListener === 'undefined' ) {
31
+ // Don't run this initializer under FastBoot
32
+ return ;
33
+ }
34
+ window . addEventListener ( 'hashchange' , hashchange ) ;
33
35
34
36
// If clicking on a link to the same fragment as currently in the address bar,
35
37
// hashchange won't be fired, so we need to manually trigger rescroll.
36
- $ ( document ) . on ( 'a[href]' , 'click' , function ( event ) {
38
+ document . addEventListener ( 'click' , function ( event ) {
39
+ if ( event . target . tagName !== 'A' ) {
40
+ return ;
41
+ }
37
42
if ( this . href === location . href && location . hash . length > 1 ) {
38
43
setTimeout ( function ( ) {
39
44
if ( ! event . defaultPrevented ) {
You can’t perform that action at this time.
0 commit comments