开发者

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

开发者 https://www.devze.com 2023-04-01 16:50 出处:网络
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>

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

精彩评论

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

关注公众号