I just installed the new version of prototype but got the following error in Firefox: $(parentElement || document.body) has no properties on line 4180 of prototype.js. Has anyone else run into this error and been able to fix it? Thanks in advance, Vinicius
on 2008-07-10 03:11
on 2008-07-10 03:37
Are you calling document.getElementsByClassName before the dom loads? document.getElementsByClassName is deprecated because some browsers support it natively and their implementation is different than Prototypes. You should use $$() instead and only after the dom loads. - JDD
on 2008-07-10 09:03
Hi, We've started transitioning to a new, better-named, hopefully-spam- free group for Prototype and script.aculo.us: http://groups.google.com/group/prototype-scriptaculous/ prototype-scriptaculous@googlegroups.com Please post any new questions there rather than here, we're just trying to finish up existing conversations here... Thanks, -- T.J. Crowder tj / crowder software / com
on 2008-07-10 13:57
On 10 Jul 2008, at 03:36, jdalton wrote: > Are you calling document.getElementsByClassName before the dom loads? > document.getElementsByClassName is deprecated because some browsers > support it natively and their implementation is different than > Prototypes. You should use $$() instead and only after the dom loads. or just do $A(document.getElementsByClassName('classname')), which will return an extended element array.
on 2008-07-10 14:48
But not an array of extended elements. :-) -Fred On Thu, Jul 10, 2008 at 6:56 AM, Peter De Berdt <peter.de.berdt@pandora.be> wrote: > or just do $A(document.getElementsByClassName('classname')), which > will return an extended element array. -- Science answers questions; philosophy questions answers.
on 2008-07-10 15:25
@Frederick - in this case
$A(document.getElementsByClassName('classname')) would convert the
nodeList into an array (arrays are naturally extended via
their .prototype). In Firefox and other browsers all HTML elements
inherit from the Element.prototype so the elements would already be
extended.
@Peter - The fact that document.getElementsByClassName() is deprecated
is reason enough not to use it. Also it is painfully long to type
whereas $$() or element.select() are much easier.
- JDD