Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 46bb08a

Browse files
committed
fix(compiler): reading comment throws error in ie
Unders some circumstances reading the comment's text throws error.
1 parent 94dd685 commit 46bb08a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/ng/compiler.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,17 @@ function $CompileProvider($provide) {
467467
addTextInterpolateDirective(directives, node.nodeValue);
468468
break;
469469
case 8: /* Comment */
470-
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
471-
if (match) {
472-
nName = directiveNormalize(match[1]);
473-
if (addDirective(directives, nName, 'M', maxPriority)) {
474-
attrs[nName] = trim(match[2]);
470+
try {
471+
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
472+
if (match) {
473+
nName = directiveNormalize(match[1]);
474+
if (addDirective(directives, nName, 'M', maxPriority)) {
475+
attrs[nName] = trim(match[2]);
476+
}
475477
}
478+
} catch (e) {
479+
// turns out that under some circumstances IE9 throws errors when one attempts to read comment's node value.
480+
// Just ignore it and continue. (Can't seem to reproduce in test case.)
476481
}
477482
break;
478483
}

0 commit comments

Comments
 (0)