Javascript html,Firefox在属性中编码qoutes
我有一个热修复程序,可以生成HTML幻灯片。这些模块是在Jquery中构建的,后台是内联CSS(这是我能想到的最好的解决方案,因为每个实例都是唯一的) 问题在于firefox将style属性中的引号转换为:Javascript html,Firefox在属性中编码qoutes,javascript,jquery,Javascript,Jquery,我有一个热修复程序,可以生成HTML幻灯片。这些模块是在Jquery中构建的,后台是内联CSS(这是我能想到的最好的解决方案,因为每个实例都是唯一的) 问题在于firefox将style属性中的引号转换为: <div style="background-image: url("bigspace-template.jpg");" class="nuiOpenspace t1 skin1"> 然后,我从dom中
<div style="background-image: url("bigspace-template.jpg");"
class="nuiOpenspace t1 skin1">
然后,我从dom中获取HTML,将其转换为字符串,然后将其输出到文本区域:
function Source(){
this.print = function(o, c_val){
//var parsed_html = this.parse(o, c_val);
//var pretty_html = "";
//pretty_html = style_html( parsed_html );
//console.info(x.replaceAll('&qout;', 'x'));
$code.text( style_html($("#sandbox").html()) );
};
}
var source = new Source();
我尝试过搜索和替换,但firefox一直在更改为/添加。有什么想法吗?据我所知,
“
是一个”
,所以你有“
在它自己的”
之间。我想这永远不会像这样工作
如果您想将原始代码(在firefox中不起作用的代码)更改为有效代码(使用转义符或
“
和”
的组合,而不是“嵌套的”“
),您不是更接近解决方案了吗?您是否尝试过使用单个qoutes?”
。或者,您可以将其放在一个临时元素中,然后获取.text()
function Sandbox(){
var $sandbox = $("#sandbox");
this.fill = function(o) {
$sandbox.empty();
$sandbox.append(o);
};
// ...
}
function Source(){
this.print = function(o, c_val){
//var parsed_html = this.parse(o, c_val);
//var pretty_html = "";
//pretty_html = style_html( parsed_html );
//console.info(x.replaceAll('&qout;', 'x'));
$code.text( style_html($("#sandbox").html()) );
};
}
var source = new Source();