View Single Post
Old 05-15-2008, 07:38 PM   PM User | #6
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
wrap the getElementsByClassName function with $A().

or replace the whole lot with:
Code:
getText: function() {
  this.element.getElementsBySelector('.'+this.options.emptyClassName).invoke('remove');
}
The result of the getElsByClass isn't actually an array (it just acts a lot like one...), and so the Prototype extensions (.each and so on) aren't added to it. getElementsBySelector takes a CSS rule, so add a '.' to the front for a classname-restriction and returns an actual array of prototype-extended elements. Rather than removing the element from it's parent explicity, prototype gives you a 'remove()' method on elements, and by using 'invoke' you remove the need for an anonymous function.
__________________
My thoughts on some things: http://codemeetsmusic.com
And my scrapbook of cool things: http://gjones.tumblr.com
GJay is offline   Reply With Quote