jQuery html()默认情况下正在解码html实体? [英] jquery html() is decoding html entities by default?

查看:166
本文介绍了jQuery html()默认情况下正在解码html实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么地球上的jQuery html()会这样做,但是在我这样做之后

I dont know why on earth jquery html() is doing this, but after i do

$('html').html()

我将& copy"自动转换为©

i get "&copy" automatically converted to ©

无论如何要避免这种情况?我需要使用javascript转储页面的html,并且不需要这种无用的转换来破坏html.

anyway to avoid this? I need to dump the html of the page using javascript and dont need this useless conversions that are screwing up the html.

推荐答案

这真的不是jQuery,甚至不是JavaScript.

This really isn't the jQuery, or even JavaScript for that matter.

浏览器将保留其自己的基础DOM规范化表示形式.它与文档本身非常相似,但是将保留字符解码(如上述).

The browser will hold its own normalised representation of the underlying DOM. It will bear a close resemblence the the document itself, but character decoding (like the above) will be preserved.

已阅读以下内容:

http://www.brainjar.com/dhtml/intro/

http://bytes.com/topic/javascript/answers/146257-body-innerhtml-issue

据我所知,恐怕无法解决这个问题.

I'm afraid there is no way around this as far as I am aware.

这篇关于jQuery html()默认情况下正在解码html实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆