Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  38] [ 2]  / answers: 1 / hits: 19120  / 15 Years ago, mon, june 15, 2009, 12:00:00

I know that is the reason some people don't approve of them, but does it really matter? I think that the power that they provide, in interacting with JavaScript and storing and sending information from and to the server, outweighs the validation concern. Am I missing something? What are the ramifications of invalid HTML? And wouldn't a custom DTD resolve them anyway?


More From » html

 Answers
46

The ramification is that w3c comes along in 2, 5, 10 years and creates an attribute with the same name. Now your page is broken.



HTML5 is going to provide a data attribute type for legal custom attributes (like data-myattr=foo) so maybe you could start using that now and be reasonably safe from future name collisions.



Finally, you may be overlooking that custom logic is the rational behind the class attribute. Although it is generally thought of as a style attribute it is in reality a legal way to set custom meta-properties on an element. Unfortunately you are basically limited to boolean properties which is why HTML5 is adding the data prefix.



BTW, by basically boolean I mean in principle. In reality there is nothing to stop you using a seperator in your class name to define custom values as well as attributes.



class=document docId.56 permissions.RW


[#99314] Thursday, June 11, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
patienceannel

Total Points: 674
Total Questions: 101
Total Answers: 101

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
patienceannel questions
Fri, Mar 11, 22, 00:00, 2 Years ago
Tue, Oct 20, 20, 00:00, 4 Years ago
Wed, Jul 24, 19, 00:00, 5 Years ago
;