开发者

xhtml custom attributes definition

开发者 https://www.devze.com 2023-03-11 20:06 出处:网络
If a defined custom attributes to input fields in an XHTML document are these then valid attributes? As if i v开发者_如何学Goalidate the xhtml document with w3c validator then the validator marks the

If a defined custom attributes to input fields in an XHTML document are these then valid attributes?

As if i v开发者_如何学Goalidate the xhtml document with w3c validator then the validator marks them as invalid attributes.

How may I validate then?

I have seen feww article that suggest to append them in DTD file.

What will be the best way to avoid such validation errors?

Thanks


I'm pretty sure you won't be able to get them to validate because if they don't exist as part of the specification then it will be marked invalid.

I'd suggest re-purposing standard/valid attributes to contain the values you need if w3c validation is a must.

Personally, I don't weigh much on the w3c validation because if it works or passes when doing quality control checks on your targeted browsers, then why should anyone seek the w3c approval. Ultimately the w3c validation tools are to assist with being standards compliant to cut down on the amount of errors that can occur across browsers however it isn't infallible nor can it understand every use/business case that might necessitate bending the rules a bit.

Hope this helps.


If a defined custom attributes to input fields in an XHTML document are these then valid attributes?

They might be valid according to whatever DTD or schema you use, but they won't be valid XHTML.

What will be the best way to avoid such validation errors?

To not use them.

If you really, really, really need custom attributes (and most people don't), then switch to (X)HTML 5 and use data-* attributes.

0

精彩评论

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

关注公众号