@@ -26,11 +26,13 @@ var AVAILABLE_MODULES = [
26
26
] ;
27
27
28
28
var SEVERITY_WARNING = 2 ;
29
+ var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!' ;
29
30
31
+ var deferRegex = new RegExp ( '^' + DEFER_LABEL + '.*' ) ;
30
32
// Determine whether this run is by protractor.
31
33
// If protractor is running, the bootstrap will already be deferred.
32
34
// In this case `resumeBootstrap` should be patched to load the hint modules.
33
- if ( window . name === 'NG_DEFER_BOOTSTRAP!' ) {
35
+ if ( deferRegex . test ( window . name ) ) {
34
36
var originalResumeBootstrap ;
35
37
Object . defineProperty ( angular , 'resumeBootstrap' , {
36
38
get : function ( ) {
@@ -45,10 +47,19 @@ if (window.name === 'NG_DEFER_BOOTSTRAP!') {
45
47
}
46
48
//If this is not a test, defer bootstrapping
47
49
else {
48
- window . name = 'NG_DEFER_BOOTSTRAP!' ;
50
+ window . name = DEFER_LABEL + window . name ;
49
51
50
52
// determine which modules to load and resume bootstrap
51
53
document . addEventListener ( 'DOMContentLoaded' , maybeBootstrap ) ;
54
+
55
+ /* angular should remove DEFER_LABEL from window.name, but if angular is never loaded, we want
56
+ to remove it ourselves, otherwise hint will incorrectly detect protractor as being present on
57
+ the next page load */
58
+ window . addEventListener ( 'beforeunload' , function ( ) {
59
+ if ( deferRegex . test ( window . name ) ) {
60
+ window . name = window . name . substring ( DEFER_LABEL . length ) ;
61
+ }
62
+ } ) ;
52
63
}
53
64
54
65
function maybeBootstrap ( ) {
@@ -1382,7 +1393,7 @@ function decorateRootScope($delegate, $parse) {
1382
1393
value : value
1383
1394
} ;
1384
1395
hint . emit ( 'model:change' , {
1385
- id : scopeId ,
1396
+ id : convertIdToOriginalType ( scopeId ) ,
1386
1397
path : partialPath ,
1387
1398
value : value
1388
1399
} ) ;
@@ -1589,7 +1600,7 @@ function decorateRootScope($delegate, $parse) {
1589
1600
var value = summarize ( model . get ( ) ) ;
1590
1601
if ( value !== model . value ) {
1591
1602
hint . emit ( 'model:change' , {
1592
- id : ( angular . version . minor < 3 ) ? scopeId : parseInt ( scopeId ) ,
1603
+ id : convertIdToOriginalType ( scopeId ) ,
1593
1604
path : path ,
1594
1605
oldValue : model . value ,
1595
1606
value : value
@@ -1680,4 +1691,8 @@ function isOneTimeBindExp(exp) {
1680
1691
return exp . charAt ( 0 ) === ':' && exp . charAt ( 1 ) === ':' ;
1681
1692
}
1682
1693
1694
+ function convertIdToOriginalType ( scopeId ) {
1695
+ return ( angular . version . minor < 3 ) ? scopeId : parseInt ( scopeId , 10 ) ;
1696
+ }
1697
+
1683
1698
} , { "../lib/summarize-model" :7 , "debounce-on" :2 } ] } , { } , [ 1 ] ) ;
0 commit comments