@@ -2065,26 +2065,32 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2065
2065
addTextInterpolateDirective ( directives , node . nodeValue ) ;
2066
2066
break ;
2067
2067
case NODE_TYPE_COMMENT : /* Comment */
2068
- try {
2069
- match = COMMENT_DIRECTIVE_REGEXP . exec ( node . nodeValue ) ;
2070
- if ( match ) {
2071
- nName = directiveNormalize ( match [ 1 ] ) ;
2072
- if ( addDirective ( directives , nName , 'M' , maxPriority , ignoreDirective ) ) {
2073
- attrs [ nName ] = trim ( match [ 2 ] ) ;
2074
- }
2075
- }
2076
- } catch ( e ) {
2077
- // turns out that under some circumstances IE9 throws errors when one attempts to read
2078
- // comment's node value.
2079
- // Just ignore it and continue. (Can't seem to reproduce in test case.)
2080
- }
2068
+ collectCommentDirectives ( node , directives , attrs , maxPriority , ignoreDirective ) ;
2081
2069
break ;
2082
2070
}
2083
2071
2084
2072
directives . sort ( byPriority ) ;
2085
2073
return directives ;
2086
2074
}
2087
2075
2076
+ function collectCommentDirectives ( node , directives , attrs , maxPriority , ignoreDirective ) {
2077
+ // function created because of performance, try/catch disables
2078
+ // the optimization of the whole function #14848
2079
+ try {
2080
+ var match = COMMENT_DIRECTIVE_REGEXP . exec ( node . nodeValue ) ;
2081
+ if ( match ) {
2082
+ var nName = directiveNormalize ( match [ 1 ] ) ;
2083
+ if ( addDirective ( directives , nName , 'M' , maxPriority , ignoreDirective ) ) {
2084
+ attrs [ nName ] = trim ( match [ 2 ] ) ;
2085
+ }
2086
+ }
2087
+ } catch ( e ) {
2088
+ // turns out that under some circumstances IE9 throws errors when one attempts to read
2089
+ // comment's node value.
2090
+ // Just ignore it and continue. (Can't seem to reproduce in test case.)
2091
+ }
2092
+ }
2093
+
2088
2094
/**
2089
2095
* Given a node with an directive-start it collects all of the siblings until it finds
2090
2096
* directive-end.
0 commit comments