Hi again,
well that depends on what you want to have selected:
the prototyped getElementsByClassName does:

document.getElementsByClassName = function(className, parentElement) {
 var children = ($(parentElement) || document.body).getElementsByTagName('*');
 return $A(children).inject([], function(elements, child) {
   if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
     elements.push(child);
   return elements;
 });
}

from which the most interesting pasrt is: child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))
as you can see it makes a regular expression from your parameter and searches 
for matches in the attribute className. what you give as arguement may be 
delimited by whitspacechars or start/end.
Usually you can find an expression that you can pass as parameter that fits 
still your need. if you want always match the whole attribute string, then I 
fear that you have to create your own getElementsByClassName with a different 
regex for example.

.: Fabian


-----Ursprüngliche Nachricht-----
Von: [email protected]
Gesendet: 05.01.07 12:45:29
An: "Ruby on Rails: Spinoffs" <[email protected]>
Betreff: [Rails-spinoffs] Re: Effect.Highlight



Ah, but what about with multiple class name defintions?  i.e.
class="label label-news label-news-123".  We use this kind of system to
allow us to build generic templates which our end users who actually
build the sites to override and ensure they get granular control over
the display.

I am gathering that the document.getElementsByClassName('label'); will
not work here as it would want to look for the exact class name in full?






_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to