Morgan T.
Morgan T.

Reputation: 1937

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>

then 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.

Upvotes: 2

Views: 386

Answers (1)

Jack
Jack

Reputation: 15872

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>

Upvotes: 2

Related Questions