The way I've been handling this is to allow the user to pass custom
attributes and then remove them from the DOM using removeAttribute once I'm
finished with them. For example, a wizard component we're developing:

<div class="wizard" title="Add User Wizard" current="2" links="1">
      <ol>
            <li url="example.html" title="User Information" />
            <li url="details.html" title="User Details" />
            <li url="verify.html" title="Verification" />
            <li url="confirm.html" title="Confirmation" />
      </ol>
</div>

Once the wizard is rendered by the component javascript, I remove the
"current" and "links" attributes. I then validate the generated code. I'm
not sure if this is the best way, but it seems to be working well so far.

Jeff Rankin
Human Factors
544-4333


                                                                                
                                                        
                      Michael Schuerig                                          
                                                        
                      <[EMAIL PROTECTED]>                    To:       
rails-spinoffs@lists.rubyonrails.org                           
                      Sent by:                                 cc:       (bcc: 
William J. Rankin/UPC)                                   
                      [EMAIL PROTECTED]        Subject:  [Rails-spinoffs] 
Custom attributes?                            
                      onrails.org                                               
                                                        
                                                                                
                                                        
                                                                                
                                                        
                      07/23/2006 07:01 AM                                       
                                                        
                      Please respond to rails-spinoffs                          
                                                        
                                                                                
                                                        
                                                                                
                                                        





I'm looking for a clean way to add attributes to HTML elements in order
to pass information to JavaScript. I'd like to write valid XHTML and
therefore in the past have eschewed adding non-standard attributes.
Instead, I encoded my additional information in the class attribute,
which is technically valid, but doesn't feel very clean nevertheless.
Is there a nice, easy, and validating way of achieving what I'm trying
to do?

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