diff options
| author | Misko Hevery | 2012-04-17 13:58:25 -0700 |
|---|---|---|
| committer | Misko Hevery | 2012-04-20 11:29:34 -0700 |
| commit | 46bb08a9d0780fafef6dc5c1140c71912462887a (patch) | |
| tree | a1e1532a7e72c933050f4e75573765f46c9e8ee2 | |
| parent | 94dd68570952f6f31abfa351b1159afcd3588a57 (diff) | |
| download | angular.js-46bb08a9d0780fafef6dc5c1140c71912462887a.tar.bz2 | |
fix(compiler): reading comment throws error in ie
Unders some circumstances reading the comment's text throws error.
| -rw-r--r-- | src/ng/compiler.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ng/compiler.js b/src/ng/compiler.js index 2ae2f891..59a70145 100644 --- a/src/ng/compiler.js +++ b/src/ng/compiler.js @@ -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; } |
