开发者

About Xhtml Guideline

There are certain guide lines to be followed while writing Html for you page.

my question is what if we dont follow those rules. Iam asking this because my site heavily work with javascript for dom manipulation and there are certain points where we have to add custom attributes.

I want to know what problems i may face by not following guidelin开发者_运维知识库es.


A lot a well-accepted libraries (JQuery comes to mind, but I doubt it's the only one) add "invalid" attributes through direct DOM manipulation. No one seems to care, even fierce advocates of valid content, and browsers will usually ignore unrecognized attributes (tags get a different treatment).

When it comes to best practices, I'd advise you prefix your nonstandard attributes with a proprietary prefix, to avoid any conflict in potential future revision of the standards.


Different browsers will treat invalid markup in different ways. Custom attributes, though, are universally ignored AFAIK.

It's still best to test your markup in as many clients as possible to ensure it works as expected.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜