Hey there. I am making my syntax shortcut for Javascript and CSS and I am having a problem with Internet Explorer (big surprise). I grab the entire contents of the tag code.block(example below) with innerHTMLand .split("\n"), which produce each line. This works great except IE.
code.block
innerHTML
.split("\n")
I tried using innerTextand .split("\r\n")also without success. Can anyone recommend a solution? If that matters, tags code.blockhave style white-space:pre-wrap.
innerText
.split("\r\n")
white-space:pre-wrap
<code class="block css">div#randomBarsDemo { width:175px; height:200px; } div#randomBarsDemo div { background-color:#111; width:100%; }</code>
, ( IE8 Windows, ) - innerText , \r <br/> innerHTML
\r
<br/>
var el = document.getElementById('target'); el.innerHTML = el.innerText.replace(/\r/,"<br/>");
, , .split() <BR>. <BR>, <br/> HTML Internet Explorer.
.split()
<BR>
, , innerText \r s, \n. , , , , .
\n
, , . script, .
http://blog.stevenlevithan.com/archives/cross-browser-split
Source: https://habr.com/ru/post/1744857/More articles:Javascript Phone Number Recognition - javascriptRegular expression - add target = "blank" to all links of the tag in my content - c #могу ли я получить доступ к структуре внутри структуры без использования оператора точки? - c++Using ed to manage files matching search - bashOutdated pear installation errors - phpselect n largest using LINQ - c #Line output Labview - stringРазрешение двусмысленного указателя на С++ - c++PHP does not obey my specific ETags - phpOne to two relationships in the Doctrine with YAML - mysqlAll Articles