The code I pasted is from prototype.js, and I didn't write the code. There seems to be an IE8 error, when prototype.js is defining getElementsByClassName. I just used magento, with wowslider, and got this error. I'm not sure where it is coming from.
On Jun 8, 8:53 pm, Jason Westbrook <jwestbr...@gmail.com> wrote: > Are you wanting to collect all of the child elements of $(element) ? > > try using $(element).childElements() > > but actually looking at the whole code it looks like you are defining > getElementsByClassName - there is already functionality in prototype to do > this > > $$(".classname") will return a list of elements with that classname in the > entire DOM > > if you need to select all elements that are children of a certain node > $("element").select(".classname") will do that > > Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com > > > > > > > > On Fri, Jun 8, 2012 at 12:51 AM, nbezzala <nbezz...@gmail.com> wrote: > > I am using prototype version 1.7 on IE8. It works fine on Firefox and > > Opera. > > > The error is in this line > > var nodes = $(element).getElementsByTagName('*'); > > > Below is the code around it. > > > / > > *-------------------------------------------------------------------------- > > */ > > > if (!document.getElementsByClassName) document.getElementsByClassName > > = function(instanceMethods){ > > function iter(name) { > > return name.blank() ? null : "[contains(concat(' ', @class, ' '), > > ' " + name + " ')]"; > > } > > > instanceMethods.getElementsByClassName = > > Prototype.BrowserFeatures.XPath ? > > function(element, className) { > > className = className.toString().strip(); > > var cond = /\s/.test(className) ? > > $w(className).map(iter).join('') : iter(className); > > return cond ? document._getElementsByXPath('.//*' + cond, > > element) : []; > > } : function(element, className) { > > className = className.toString().strip(); > > var elements = [], classNames = (/\s/.test(className) ? > > $w(className) : null); > > if (!classNames && !className) return elements; > > > var nodes = $(element).getElementsByTagName('*'); > > className = ' ' + className + ' '; > > > for (var i = 0, child, cn; child = nodes[i]; i++) { > > if (child.className && (cn = ' ' + child.className + ' ') && > > (cn.include(className) || > > (classNames && classNames.all(function(name) { > > return !name.toString().blank() && cn.include(' ' + name + > > ' '); > > })))) > > elements.push(Element.extend(child)); > > } > > return elements; > > }; > > > return function(className, parentElement) { > > return $(parentElement || > > document.body).getElementsByClassName(className); > > }; > > }(Element.Methods); > > > / > > *-------------------------------------------------------------------------- > > */ > > > -- > > You received this message because you are subscribed to the Google Groups > > "Prototype & script.aculo.us" group. > > To post to this group, send email to > > prototype-scriptaculous@googlegroups.com. > > To unsubscribe from this group, send email to > > prototype-scriptaculous+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.