Forum: Rails Spinoffs (closed, excessive spam) Prototype 1.6.02 Error in Firefox

2855f5847bfceebcbac15b5269bc7fbc?d=identicon&s=25 Vinicius Vacanti (Guest)
on 2008-07-10 03:11
(Received via mailing list)
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
299a3d891ff1920b69c364d061007043?d=identicon&s=25 jdalton (Guest)
on 2008-07-10 03:37
(Received via mailing list)
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
Ca3e484c121268e4c8302616b2395eb9?d=identicon&s=25 T.J. Crowder (Guest)
on 2008-07-10 09:03
(Received via mailing list)
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
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2008-07-10 13:57
(Received via mailing list)
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.
F490e41cd5de1393a9f6958b70dae6ab?d=identicon&s=25 Frederick Polgardy (Guest)
on 2008-07-10 14:48
(Received via mailing list)
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.
299a3d891ff1920b69c364d061007043?d=identicon&s=25 jdalton (Guest)
on 2008-07-10 15:25
(Received via mailing list)
@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
2855f5847bfceebcbac15b5269bc7fbc?d=identicon&s=25 Vinicius Vacanti (Guest)
on 2008-07-15 01:27
(Received via mailing list)
This solved my problem.  Thanks!
This topic is locked and can not be replied to.