File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change 28
28
var initialHref = attrs [ attr ] ;
29
29
var parsingNode ;
30
30
31
- if ( initialHref && initialHref . indexOf ( '#' ) === 0 ) {
32
- parsingNode = document . createElement ( 'a' )
33
-
34
- attrs . $observe ( attr , updateValue ) ;
35
- $rootScope . $on ( '$locationChangeSuccess' , updateValue ) ;
36
-
37
- function updateValue ( ) {
38
- var newVal ;
39
- parsingNode . setAttribute (
40
- 'href' ,
41
- location . pathname + location . search + initialHref
42
- ) ;
43
- newVal = parsingNode . toString ( ) ;
44
- if ( newVal && attrs [ attr ] !== newVal ) {
45
- attrs . $set ( attr , newVal ) ;
46
- }
31
+ if ( ! initialHref || initialHref . charAt ( 0 ) !== '#' ) {
32
+ return ;
33
+ }
34
+
35
+ parsingNode = document . createElement ( 'a' ) ;
36
+
37
+ attrs . $observe ( attr , updateValue ) ;
38
+ $rootScope . $on ( '$locationChangeSuccess' , updateValue ) ;
39
+
40
+ function updateValue ( ) {
41
+ var newVal ;
42
+ parsingNode . setAttribute (
43
+ 'href' ,
44
+ location . pathname + location . search + initialHref
45
+ ) ;
46
+ newVal = parsingNode . toString ( ) ;
47
+ if ( newVal && attrs [ attr ] !== newVal ) {
48
+ attrs . $set ( attr , newVal ) ;
47
49
}
48
50
}
49
51
}
You can’t perform that action at this time.
0 commit comments