-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ie8 FF inserting-a-comment-in-innerhtml error #17
Comments
sorry, I don't understand. |
刚看到您是台湾的,那我打中文。。。英文不好~ <div class="lazyload">
<!--
<img src="image.png" />
-->
</div> 在有些场景(ajax、模板等)使用中,需要动态的去插入这些代码,如 var tpl = '<div class="lazyload"><!--<img src="image.png" />--></div>'
// 写入
document.getElementsByTagName("body")[0].innerHTML = tpl
$(".lazyload").lazyload() 这个的时候,在ie8或者某些firefox版本中,写入的其实是
也就是说,注释里的内容被过滤掉了…… 还有一种情况,网站如果使用cdn的并且开启代码优化的话,注视也会被过滤掉… 所以,注释这种的方式好像不是很安全 |
Hi, 感謝你的建議, 未來將考慮增加其他的方式改善這個問題, 可能的方式是用屬性實現 |
Hi, 805063c 新增兩種使用方式可解決此問題 |
非常感谢! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/15006001/inserting-a-comment-in-innerhtml
The text was updated successfully, but these errors were encountered: