Home  >  Article  >  Web Front-end  >  IE下innerText与FoxFire下textContent属性的不同_html/css_WEB-ITnose

IE下innerText与FoxFire下textContent属性的不同_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:33:121293browse

<div> 我是中国 人 我<br/>爱 自己 的<div>祖国</div>。<div> 

 

IE下输出

 

我是中国 人 我爱 自己 的 祖国<br />。

总结:(IE中的innerText是需要对innerHTML的值进行)

1、HTML转义(等同于XML转义,对2、经过HTML解释和CSS样式解释;
3、之后又剔除格式信息之后留下的纯文本。

 

FoxFire下输出

(换行)我是中国人 我爱 自己的祖国。

 总结:

textContent没有2、3步,在经过了HTML转义之后直接剔除所有html标签后得到的纯文本。

Statement:
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