@@ -479,11 +479,13 @@ var AVAILABLE_MODULES = [
479
479
] ;
480
480
481
481
var SEVERITY_WARNING = 2 ;
482
+ var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!' ;
482
483
484
+ var deferRegex = new RegExp ( '^' + DEFER_LABEL + '.*' ) ;
483
485
// Determine whether this run is by protractor.
484
486
// If protractor is running, the bootstrap will already be deferred.
485
487
// In this case `resumeBootstrap` should be patched to load the hint modules.
486
- if ( window . name === 'NG_DEFER_BOOTSTRAP!' ) {
488
+ if ( deferRegex . test ( window . name ) ) {
487
489
var originalResumeBootstrap ;
488
490
Object . defineProperty ( angular , 'resumeBootstrap' , {
489
491
get : function ( ) {
@@ -498,10 +500,19 @@ if (window.name === 'NG_DEFER_BOOTSTRAP!') {
498
500
}
499
501
//If this is not a test, defer bootstrapping
500
502
else {
501
- window . name = 'NG_DEFER_BOOTSTRAP!' ;
503
+ window . name = DEFER_LABEL + window . name ;
502
504
503
505
// determine which modules to load and resume bootstrap
504
506
document . addEventListener ( 'DOMContentLoaded' , maybeBootstrap ) ;
507
+
508
+ /* angular should remove DEFER_LABEL from window.name, but if angular is never loaded, we want
509
+ to remove it ourselves, otherwise hint will incorrectly detect protractor as being present on
510
+ the next page load */
511
+ window . addEventListener ( 'beforeunload' , function ( ) {
512
+ if ( deferRegex . test ( window . name ) ) {
513
+ window . name = window . name . substring ( DEFER_LABEL . length ) ;
514
+ }
515
+ } ) ;
505
516
}
506
517
507
518
function maybeBootstrap ( ) {
@@ -1835,7 +1846,7 @@ function decorateRootScope($delegate, $parse) {
1835
1846
value : value
1836
1847
} ;
1837
1848
hint . emit ( 'model:change' , {
1838
- id : scopeId ,
1849
+ id : convertIdToOriginalType ( scopeId ) ,
1839
1850
path : partialPath ,
1840
1851
value : value
1841
1852
} ) ;
@@ -2042,7 +2053,7 @@ function decorateRootScope($delegate, $parse) {
2042
2053
var value = summarize ( model . get ( ) ) ;
2043
2054
if ( value !== model . value ) {
2044
2055
hint . emit ( 'model:change' , {
2045
- id : ( angular . version . minor < 3 ) ? scopeId : parseInt ( scopeId ) ,
2056
+ id : convertIdToOriginalType ( scopeId ) ,
2046
2057
path : path ,
2047
2058
oldValue : model . value ,
2048
2059
value : value
@@ -2133,4 +2144,8 @@ function isOneTimeBindExp(exp) {
2133
2144
return exp . charAt ( 0 ) === ':' && exp . charAt ( 1 ) === ':' ;
2134
2145
}
2135
2146
2147
+ function convertIdToOriginalType ( scopeId ) {
2148
+ return ( angular . version . minor < 3 ) ? scopeId : parseInt ( scopeId , 10 ) ;
2149
+ }
2150
+
2136
2151
} , { "../lib/summarize-model" :9 , "debounce-on" :4 } ] } , { } , [ 1 ] ) ;
0 commit comments