Home > Web Front-end > JS Tutorial > body text

CodeMirror2 IE7/IE8 solution to the following unknown runtime error_javascript skills

WBOY
Release: 2016-05-16 17:54:54
Original
1645 people have browsed it

The original error code is as follows:

Copy code The code is as follows:





The reason for the error should be that P in IE7 and IE8 does not support innerHTML. The author of CodeMirror also discovered this problem. Related links:
 https://github.com/marijnh/CodeMirror2/issues/215
 https://github.com/ marijnh/CodeMirror2/commit/4886415d6054571f92fa4d5601ebe7d601e952ab
Copy the code The code is as follows:

try { stringWidth("x"); }
catch (e) {
if (e.message.match(/runtime/i) || e.message.match(/runtime/i) )
e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
throw e;
}

Throw the textarea outside Change the p of the layer to div and it will work fine:
Copy the code The code is as follows:

< ;div style="margin-top:0;">


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template