I usually tried to use DOM attributes only when writing Javascript. Now that I have switched from Prototype to jQuery, I can get some serious mileage from adding my own attributes to the various DOM elements, mainly because you can set up a very readable coding convention to handle AJAX requests.
As a brief example, this means that I am doing things like
<div type="book" app_id="13"> <a href="#" action="delete">delete</a> </div>
And then I can configure the code to find all the <a> tags with the action attribute, find the parent with type and app_id , and then do the CRUD operations ... all without me, to write extra code.
Are there any pitfalls (with the exception of not strictly XHTML complaints) that I should follow, and / or any good habits that I should look for to follow? What about the standard way to configure my own attribute namespace?
jquery html xml namespaces xhtml
Don werve
source share