File tree 1 file changed +19
-12
lines changed
1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change 14
14
} ;
15
15
16
16
define ( {
17
- load : function ( name , req , load ) {
18
- var link = createLink ( name ) ,
19
- head = doc . getElementsByTagName ( 'head' ) [ 0 ] ,
20
- test , interval ;
17
+ load : function ( name , req , load ) {
18
+ var head = doc . getElementsByTagName ( 'head' ) [ 0 ] ,
19
+ test ,
20
+ interval ,
21
+ link ;
21
22
22
23
test = doc . createElement ( 'div' ) ;
23
24
test . className = resolveClassName ( name ) ;
24
25
test . style . cssText = 'position: absolute;left:-9999px;top:-9999px;' ;
25
26
docBody . appendChild ( test ) ;
26
27
27
- head . appendChild ( link ) ;
28
+ if ( test . offsetHeight > 0 ) {
29
+ docBody . removeChild ( test ) ;
30
+ load ( ) ;
31
+ } else {
32
+ link = createLink ( name ) ,
33
+ head . appendChild ( link ) ;
28
34
29
- interval = win . setInterval ( function ( ) {
30
- if ( test . offsetHeight > 0 ) {
31
- clearInterval ( interval ) ;
32
- docBody . removeChild ( test ) ;
33
- load ( link ) ;
34
- }
35
- } , 50 ) ;
35
+ interval = win . setInterval ( function ( ) {
36
+ if ( test . offsetHeight > 0 ) {
37
+ clearInterval ( interval ) ;
38
+ docBody . removeChild ( test ) ;
39
+ load ( link ) ;
40
+ }
41
+ } , 50 ) ;
42
+ }
36
43
}
37
44
} ) ;
38
45
} ) ( window ) ;
You can’t perform that action at this time.
0 commit comments