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