I've been using custom attributes for a while for various things including widgets and form validation. On projects other than .Net I would put them in namespaces. .Net seems to complain about having namespaced attributes on elements that runat="server". I see this as a perfect way of adding functionality to your document. Using the class attribute in my mind is messing with the specs. It is called eXtensible HTML afterall. If you really cared about validating your code, maybe for a big project with lots of contributors, you can just extend the XHTML 1 DOCTYPE to include your custom attributes and use a true XML validator. Validation isn't the end all be all. It is a great starting point for people to begin to get an understanding of XHTML. One of the reasons I've done this is to production faster and easier on the rest of the front-end team. For example on the Validator. All they have to do is put validate="true" on the form tag and then various attributes on other elements throughout the form. Like required, datatype, etc. No _javascript_ is required at all.

Brandon

On 7/23/06, Michael Schuerig <[EMAIL PROTECTED]> wrote:

> On 7/23/06, Michael Schuerig <[EMAIL PROTECTED]> wrote:
[passing information in additional, custom attributes]

On Sunday 23 July 2006 21:09, Ryan Gahl wrote:
> Just off the top of my head, I'm gonna go on a limb here and say you
> can use other means to pass this data to the js environment without
> mucking up your markup. That is assuming this is not really
> semantically relevant data, but rather some meta-information or
> application state stuff you're trying to marshal back and forth.
>
> Why not simply render _javascript_ tags packaged with this data
> ("script" is a valid xhtml tag ya know)...

Yes, I know, but I'd like to avoid sprinkling script elements all over
the page. In particular, when it is really just declarative data I want
to attach to elements. An example is type/format/length information for
use in client-side validation.

Michael

--
Michael Schuerig
mailto:[EMAIL PROTECTED]
http://www.schuerig.de/michael/
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to