开发者

Can I prevent Firefox from stripping custom html attributes on Paste?

If you copy some html on a page that has a custom html attribute e.g.

<p foo='bar'>this is a paragraph with custom attribute</p>

th开发者_如何学JAVAen paste it into a contenteditable element, Firefox will remove the foo attribute. It will retain any html-compliant attributes like id, name etc but none that do not conform. Is there any way to prevent this and allow it to be pasted? IE and Chrome both allow this.


You can use data elements, see here: http://html5doctor.com/html5-custom-data-attributes/

<li data-spacing="10cm" data-sowing-time="March to June">Carrots</li>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜