开发者_C百科Just to be sure it can be safely used with JQuery scripting.
It's part of the HTML 4.01 Specification and should only be used as an attribute of the a
and link
tag (see the spec). Within a
and link
tags, it's well supported.
According to the HTML 4.01 specification, rel
is only valid on a
and link
elements.
As browsers don't validate documents you can get away with using it on any element you like, but it won't be valid, and it will be semantically meaningless.
You'd really need to expand on what you mean by "compatible with all browsers". All browsers will be able to render a document containing rel
attributes without barfing, even if they don't explicitly understand what it means. However, if you want to know whether all major browsers would take an explicit action when they encounter a rel attribute, you'd need to specify what situation you're thinking of and what you hope the browsers would do.
As for being compatible with all tags - no, the rel attribute is only appropriate for A
and LINK
tags in HTML 4 (as per the spec).
If you want to store custom data, you're better off using custom attributes. If you prefix them with "data-" then they are valid html5 as well.
See: http://ajaxian.com/archives/embed-your-data-in-html-5
精彩评论