66 getCacheData ,
77 getInheritedData ,
88 isTextNode ,
9+ NodeType ,
910 setCacheData ,
1011 setIsolateScope ,
1112 setScope ,
@@ -18,6 +19,7 @@ import {
1819 assertNotHasOwnProperty ,
1920 bind ,
2021 directiveNormalize ,
22+ entries ,
2123 equals ,
2224 extend ,
2325 getNodeName ,
@@ -87,7 +89,7 @@ export class CompileProvider {
8789
8890 const bindings = Object . create ( null ) ;
8991
90- Object . entries ( scope ) . forEach ( ( [ scopeName , definition ] ) => {
92+ entries ( scope ) . forEach ( ( [ scopeName , definition ] ) => {
9193 definition = definition . trim ( ) ;
9294
9395 if ( definition in bindingCache ) {
@@ -174,10 +176,10 @@ export class CompileProvider {
174176 directive . require || ( directive . controller && directive . name ) ;
175177
176178 if ( ! isArray ( require ) && isObject ( require ) ) {
177- const entries = Object . entries ( require ) ;
179+ const entryList = entries ( require ) ;
178180
179- for ( let i = 0 , len = entries . length ; i < len ; i ++ ) {
180- const [ key , value ] = entries [ i ] ;
181+ for ( let i = 0 , len = entryList . length ; i < len ; i ++ ) {
182+ const [ key , value ] = entryList [ i ] ;
181183
182184 const match = value . match ( REQUIRE_PREFIX_REGEXP ) ;
183185
@@ -271,7 +273,7 @@ export class CompileProvider {
271273 }
272274 hasDirectives [ name ] . push ( directiveFactory ) ;
273275 } else {
274- Object . entries ( name ) . forEach ( ( [ k , v ] ) => registerDirective ( k , v ) ) ;
276+ entries ( name ) . forEach ( ( [ k , v ] ) => registerDirective ( k , v ) ) ;
275277 }
276278
277279 return this ;
@@ -323,7 +325,7 @@ export class CompileProvider {
323325 */
324326 this . component = function ( name , options ) {
325327 if ( ! isString ( name ) ) {
326- Object . entries ( name ) . forEach ( ( [ key , val ] ) => this . component ( key , val ) ) ;
328+ entries ( name ) . forEach ( ( [ key , val ] ) => this . component ( key , val ) ) ;
327329
328330 return this ;
329331 }
@@ -368,7 +370,7 @@ export class CompileProvider {
368370 } ;
369371
370372 // Copy annotations (starting with $) over to the DDO
371- Object . entries ( options ) . forEach ( ( [ key , val ] ) => {
373+ entries ( options ) . forEach ( ( [ key , val ] ) => {
372374 if ( key . charAt ( 0 ) === "$" ) {
373375 ddo [ key ] = val ;
374376 }
@@ -379,7 +381,7 @@ export class CompileProvider {
379381
380382 // Copy any annotation properties (starting with $) over to the factory and controller constructor functions
381383 // These could be used by libraries such as the new component router
382- Object . entries ( options ) . forEach ( ( [ key , val ] ) => {
384+ entries ( options ) . forEach ( ( [ key , val ] ) => {
383385 if ( key . charAt ( 0 ) === "$" ) {
384386 factory [ key ] = val ;
385387
@@ -1056,7 +1058,7 @@ export class CompileProvider {
10561058 let nodeName ;
10571059
10581060 switch ( nodeType ) {
1059- case 1 /* Element */ :
1061+ case NodeType . _ELEMENT_NODE /* Element */ :
10601062 nodeName = node . nodeName . toLowerCase ( ) ;
10611063
10621064 if ( ignoreDirective !== directiveNormalize ( nodeName ) ) {
@@ -1174,7 +1176,7 @@ export class CompileProvider {
11741176 }
11751177
11761178 break ;
1177- case Node . TEXT_NODE :
1179+ case NodeType . _TEXT_NODE :
11781180 addTextInterpolateDirective ( directives , node . nodeValue ) ;
11791181 break ;
11801182 default :
@@ -1438,7 +1440,7 @@ export class CompileProvider {
14381440
14391441 // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
14401442 if ( controllerDirectives ) {
1441- Object . entries ( controllerDirectives ) . forEach (
1443+ entries ( controllerDirectives ) . forEach (
14421444 ( [ name , controllerDirective ] ) => {
14431445 const { require } = controllerDirective ;
14441446
@@ -1817,7 +1819,7 @@ export class CompileProvider {
18171819 const filledSlots = Object . create ( null ) ;
18181820
18191821 // Parse the element selectors
1820- Object . entries ( directiveValue ) . forEach (
1822+ entries ( directiveValue ) . forEach (
18211823 ( [ slotName , elementSelector ] ) => {
18221824 // If an element selector starts with a ? then it is optional
18231825 const optional = elementSelector . charAt ( 0 ) === "?" ;
@@ -1859,7 +1861,7 @@ export class CompileProvider {
18591861 } ) ;
18601862
18611863 // Check for required slots that were not filled
1862- Object . entries ( filledSlots ) . forEach ( ( [ slotName , filled ] ) => {
1864+ entries ( filledSlots ) . forEach ( ( [ slotName , filled ] ) => {
18631865 if ( ! filled ) {
18641866 throw $compileMinErr (
18651867 "reqslot" ,
@@ -1937,11 +1939,14 @@ export class CompileProvider {
19371939 if ( isString ( $template ) ) {
19381940 $template = Array . from (
19391941 createNodelistFromHTML ( $template ) ,
1940- ) . filter ( ( x ) => x . nodeType === 1 ) ;
1942+ ) . filter ( ( x ) => x . nodeType === NodeType . _ELEMENT_NODE ) ;
19411943 }
19421944 compileNode = $template [ 0 ] ;
19431945
1944- if ( $template . length !== 1 || compileNode . nodeType !== 1 ) {
1946+ if (
1947+ $template . length !== 1 ||
1948+ compileNode . nodeType !== NodeType . _ELEMENT_NODE
1949+ ) {
19451950 throw $compileMinErr (
19461951 "tplrt" ,
19471952 "Template for directive '{0}' must have exactly one root element. {1}" ,
@@ -2150,7 +2155,7 @@ export class CompileProvider {
21502155 if (
21512156 inheritType === "^^" &&
21522157 $element &&
2153- $element . nodeType === Node . DOCUMENT_NODE
2158+ $element . nodeType === NodeType . _DOCUMENT_NODE
21542159 ) {
21552160 // inheritedData() uses the documentElement when it finds the document, so we would
21562161 // require from the element itself.
@@ -2185,7 +2190,7 @@ export class CompileProvider {
21852190 }
21862191 } else if ( isObject ( require ) ) {
21872192 value = { } ;
2188- Object . entries ( require ) . forEach ( ( [ property , controller ] ) => {
2193+ entries ( require ) . forEach ( ( [ property , controller ] ) => {
21892194 value [ property ] = getControllers (
21902195 directiveName ,
21912196 controller ,
@@ -2341,7 +2346,7 @@ export class CompileProvider {
23412346 const dstAttr = dst . $attr ;
23422347
23432348 // reapply the old attributes to the new element
2344- Object . entries ( dst ) . forEach ( ( [ key , value ] ) => {
2349+ entries ( dst ) . forEach ( ( [ key , value ] ) => {
23452350 if ( key . charAt ( 0 ) !== "$" ) {
23462351 if ( src [ key ] && src [ key ] !== value ) {
23472352 if ( value . length ) {
@@ -2355,7 +2360,7 @@ export class CompileProvider {
23552360 } ) ;
23562361
23572362 // copy the new attributes on the old attrs object
2358- Object . entries ( src ) . forEach ( ( [ key , value ] ) => {
2363+ entries ( src ) . forEach ( ( [ key , value ] ) => {
23592364 // Check if we already set this attribute in the loop above.
23602365 // `dst` will never contain hasOwnProperty as DOM parser won't let it.
23612366 // You will get an "InvalidCharacterError: DOM Exception 5" error if you
@@ -2451,8 +2456,8 @@ export class CompileProvider {
24512456 createNodelistFromHTML ( content ) ,
24522457 ) . filter (
24532458 ( node ) =>
2454- node . nodeType !== Node . COMMENT_NODE &&
2455- node . nodeType !== Node . TEXT_NODE ,
2459+ node . nodeType !== NodeType . _COMMENT_NODE &&
2460+ node . nodeType !== NodeType . _TEXT_NODE ,
24562461 ) ;
24572462 } else {
24582463 $template = removeComments (
@@ -2461,7 +2466,10 @@ export class CompileProvider {
24612466 }
24622467 compileNode = $template [ 0 ] ;
24632468
2464- if ( $template . length !== 1 || compileNode . nodeType !== 1 ) {
2469+ if (
2470+ $template . length !== 1 ||
2471+ compileNode . nodeType !== NodeType . _ELEMENT_NODE
2472+ ) {
24652473 throw $compileMinErr (
24662474 "tplrt" ,
24672475 "Template for directive '{0}' must have exactly one root element. {1}" ,
@@ -2513,7 +2521,7 @@ export class CompileProvider {
25132521 afterTemplateNodeLinkFn = afterTemplateNodeLinkFnCtx ?. nodeLinkFn ;
25142522
25152523 if ( $rootElement ) {
2516- Object . entries ( $rootElement ) . forEach ( ( [ i , node ] ) => {
2524+ entries ( $rootElement ) . forEach ( ( [ i , node ] ) => {
25172525 if ( node === compileNode ) {
25182526 $rootElement [ i ] = $compileNode ;
25192527 }
@@ -3091,7 +3099,7 @@ export class CompileProvider {
30913099 let changes ;
30923100
30933101 if ( bindings ) {
3094- Object . entries ( bindings ) . forEach ( ( [ scopeName , definition ] ) => {
3102+ entries ( bindings ) . forEach ( ( [ scopeName , definition ] ) => {
30953103 const {
30963104 attrName,
30973105 optional,
@@ -3273,7 +3281,7 @@ export class CompileProvider {
32733281 } else {
32743282 // manually set the handler to avoid watch cycles
32753283 if ( isObject ( val ) ) {
3276- Object . entries ( val ) . forEach ( ( [ key , value ] ) => {
3284+ entries ( val ) . forEach ( ( [ key , value ] ) => {
32773285 scope . $target [ key ] = value ;
32783286 } ) ;
32793287 } else {
@@ -3424,8 +3432,8 @@ function removeComments(jqNodes) {
34243432 const node = jqNodes [ i ] ;
34253433
34263434 if (
3427- node . nodeType === Node . COMMENT_NODE ||
3428- ( node . nodeType === Node . TEXT_NODE && node . nodeValue . trim ( ) === "" )
3435+ node . nodeType === NodeType . _COMMENT_NODE ||
3436+ ( node . nodeType === NodeType . _TEXT_NODE && node . nodeValue . trim ( ) === "" )
34293437 ) {
34303438 [ ] . splice . call ( jqNodes , i , 1 ) ;
34313439 }
0 commit comments