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

Commit

Permalink
fix(compiler): reading comment throws error in ie
Browse files Browse the repository at this point in the history
Unders some circumstances reading the comment's text throws error.
  • Loading branch information
mhevery committed Apr 20, 2012
1 parent 94dd685 commit 46bb08a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ng/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,17 @@ function $CompileProvider($provide) {
addTextInterpolateDirective(directives, node.nodeValue);
break;
case 8: /* Comment */
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
if (match) {
nName = directiveNormalize(match[1]);
if (addDirective(directives, nName, 'M', maxPriority)) {
attrs[nName] = trim(match[2]);
try {
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
if (match) {
nName = directiveNormalize(match[1]);
if (addDirective(directives, nName, 'M', maxPriority)) {
attrs[nName] = trim(match[2]);
}
}
} catch (e) {
// turns out that under some circumstances IE9 throws errors when one attempts to read comment's node value.
// Just ignore it and continue. (Can't seem to reproduce in test case.)
}
break;
}
Expand Down

0 comments on commit 46bb08a

Please sign in to comment.