@@ -1467,7 +1467,7 @@ export class CompileProvider {
14671467 // RECURSION
14681468 // We only pass the isolate scope, if the isolate directive has a template,
14691469 // otherwise the child elements do not belong to the isolate directive.
1470- var scopeToChild = scope ;
1470+ let scopeToChild = scope ;
14711471 if (
14721472 newIsolateScopeDirective &&
14731473 ( newIsolateScopeDirective . template ||
@@ -2472,6 +2472,8 @@ export class CompileProvider {
24722472 . catch ( ( error ) => {
24732473 if ( isError ( error ) ) {
24742474 $exceptionHandler ( error ) ;
2475+ } else {
2476+ $exceptionHandler ( new Error ( error ) ) ;
24752477 }
24762478 } ) ;
24772479
@@ -2579,11 +2581,12 @@ export class CompileProvider {
25792581 type = ( type || "html" ) . toLowerCase ( ) ;
25802582 switch ( type ) {
25812583 case "svg" :
2582- case "math" :
2583- /** @type { HTMLDivElement } */
2584- var wrapper = document . createElement ( "div" ) ;
2584+ case "math" : {
2585+ const wrapper =
2586+ /** @type { HTMLDivElement } */ document . createElement ( "div" ) ;
25852587 wrapper . innerHTML = `<${ type } >${ template } </${ type } >` ;
25862588 return wrapper . childNodes [ 0 ] . childNodes ;
2589+ }
25872590 default :
25882591 return template ;
25892592 }
@@ -2659,29 +2662,30 @@ export class CompileProvider {
26592662 // If you want to programmatically set explicitly trusted unsafe URLs, you should use
26602663 // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the
26612664 // `ng-bind-html` directive.
2662- var result = "" ;
2665+ let result = "" ;
26632666
26642667 // first check if there are spaces because it's not the same pattern
2665- var trimmedSrcset = trim ( value ) ;
2668+ const trimmedSrcset = trim ( value ) ;
26662669 // ( 999x ,| 999w ,| ,|, )
2667- var srcPattern = / ( \s + \d + x \s * , | \s + \d + w \s * , | \s + , | , \s + ) / ;
2668- var pattern = / \s / . test ( trimmedSrcset ) ? srcPattern : / ( , ) / ;
2670+ const srcPattern = / ( \s + \d + x \s * , | \s + \d + w \s * , | \s + , | , \s + ) / ;
2671+ const pattern = / \s / . test ( trimmedSrcset ) ? srcPattern : / ( , ) / ;
26692672
26702673 // split srcset into tuple of uri and descriptor except for the last item
2671- var rawUris = trimmedSrcset . split ( pattern ) ;
2674+ const rawUris = trimmedSrcset . split ( pattern ) ;
26722675
26732676 // for each tuples
2674- var nbrUrisWith2parts = Math . floor ( rawUris . length / 2 ) ;
2675- for ( var i = 0 ; i < nbrUrisWith2parts ; i ++ ) {
2676- var innerIdx = i * 2 ;
2677+ const nbrUrisWith2parts = Math . floor ( rawUris . length / 2 ) ;
2678+ let i ;
2679+ for ( i = 0 ; i < nbrUrisWith2parts ; i ++ ) {
2680+ const innerIdx = i * 2 ;
26772681 // sanitize the uri
26782682 result += $sce . getTrustedMediaUrl ( trim ( rawUris [ innerIdx ] ) ) ;
26792683 // add the descriptor
26802684 result += " " + trim ( rawUris [ innerIdx + 1 ] ) ;
26812685 }
26822686
26832687 // split the last item into uri and descriptor
2684- var lastTuple = trim ( rawUris [ i * 2 ] ) . split ( / \s / ) ;
2688+ const lastTuple = trim ( rawUris [ i * 2 ] ) . split ( / \s / ) ;
26852689
26862690 // sanitize the last uri
26872691 result += $sce . getTrustedMediaUrl ( trim ( lastTuple [ 0 ] ) ) ;
@@ -2985,7 +2989,7 @@ export class CompileProvider {
29852989 removeWatchCollection . push ( removeWatch ) ;
29862990 break ;
29872991
2988- case "=" :
2992+ case "=" : {
29892993 if ( ! hasOwn ( attrs , attrName ) ) {
29902994 if ( optional ) {
29912995 break ;
@@ -2998,7 +3002,6 @@ export class CompileProvider {
29983002 }
29993003
30003004 parentGet = $parse ( attrs [ attrName ] ) ;
3001- var complexExpression = ! ! parentGet . inputs ;
30023005 if ( parentGet . literal ) {
30033006 compare = equals ;
30043007 } else {
@@ -3023,7 +3026,7 @@ export class CompileProvider {
30233026 lastValue = destination . $target [ scopeName ] = parentGet (
30243027 scope . $target ,
30253028 ) ;
3026- var parentValueWatch = function parentValueWatch (
3029+ const parentValueWatch = function parentValueWatch (
30273030 parentValue ,
30283031 ) {
30293032 if ( ! compare ( parentValue , destination [ scopeName ] ) ) {
@@ -3055,7 +3058,7 @@ export class CompileProvider {
30553058 scope . $watch (
30563059 expr ,
30573060 ( val ) => {
3058- var res = $parse ( attrs [ attrName ] , parentValueWatch ) ;
3061+ const res = $parse ( attrs [ attrName ] , parentValueWatch ) ;
30593062 if ( val ) {
30603063 if ( parentGet . literal ) {
30613064 scope . $target [ attrName ] = val ;
@@ -3081,7 +3084,7 @@ export class CompileProvider {
30813084 return ;
30823085 }
30833086 if (
3084- ( complexExpression && ! parentGet . literal ) ||
3087+ ( ! ! parentGet . inputs && ! parentGet . literal ) ||
30853088 ( isUndefined ( attrs [ attrName ] ) && isDefined ( val ) )
30863089 ) {
30873090 destination . $target [ attrName ] = lastValue ;
@@ -3113,6 +3116,7 @@ export class CompileProvider {
31133116 }
31143117 removeWatchCollection . push ( removeWatch ) ;
31153118 break ;
3119+ }
31163120
31173121 case "<" :
31183122 if ( ! hasOwn ( attrs , attrName ) ) {
0 commit comments