Is there a strict set of valid attributes for XHTML?

jbubrisk

Senior member
Oct 6, 2005
506
0
71
Hi everyone,
I'm trying to find out if its "legal" to add my own custom attributes to xhtml elements, mainly form elements. So can I do this:

<input type="text" id="test" value="" required="yes" />

Note that the required field is not a standrad field. I found this page:
http://www.w3schools.com/xhtml...standardattributes.asp

While it says that those are the valid standard attributes, it doesn't explicitly say that all other attributes are invalid. Then again, when uploading some of the above xhtml code, the W3c validator doesn't like those attributes and says that "there is no attribute 'required'".

http://validator.w3.org/

Can anyone give me a concrete answer on this?

Thanks in advance,
jbubrisk
 

jbubrisk

Senior member
Oct 6, 2005
506
0
71
It looks like the answer is just that the markup wont "validate" in a Validator...

Other than that, using custom attributes is just frowned upon (since it wont validate), but it also seems to be a widely accepted practice.

Any other opinions on the matter?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Well, xhtml is supposed to be extensible, so I think in general terms if you define your own namespace you should be within the allowable limits.

Overall I don't see a lot of respect for xhtml any more. Designers and web developers seem to have come to the conclusion that HTML was good enough.
 

Woosta

Platinum Member
Mar 23, 2008
2,978
0
71
^ IE doesn't support *real* XHTML, and 99% of sites send supposed "xhtml" as text/html, and around 99% of sites wouldn't be fully valid xhtml ( if sent as an xml application and there's one markup error, yellow screen of death ). HTML 4.01 Strict or HTML 5 doctype ftw. Sending xhtml syntax as text/html is the same thing as sending it HTML 3.. the browser treats it the same way because it loses all of its xml-ness if the Content-Type is not text/html/application/xhtml+xml or similar. In other words.. the W3C created a new language based on XML using HTML, the whole point as for it to be an XML application, so why on earth send it not as an XML application?