Prototype 1.6.02 Error in Firefox

7 views
Skip to first unread message

Vinicius Vacanti

unread,
Jul 9, 2008, 9:10:44 PM7/9/08
to Ruby on Rails: Spinoffs
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

jdalton

unread,
Jul 9, 2008, 9:36:53 PM7/9/08
to Ruby on Rails: Spinoffs
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

T.J. Crowder

unread,
Jul 10, 2008, 3:02:51 AM7/10/08
to Ruby on Rails: Spinoffs
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-s...@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

Peter De Berdt

unread,
Jul 10, 2008, 7:56:59 AM7/10/08
to rubyonrail...@googlegroups.com

or just do $A(document.getElementsByClassName('classname')), which
will return an extended element array.

Frederick Polgardy

unread,
Jul 10, 2008, 8:47:35 AM7/10/08
to rubyonrail...@googlegroups.com
But not an array of extended elements. :-)

-Fred


On Thu, Jul 10, 2008 at 6:56 AM, Peter De Berdt <peter.d...@pandora.be> wrote:
or just do $A(document.getElementsByClassName('classname')), which
will return an extended element array.

--
Science answers questions; philosophy questions answers.

jdalton

unread,
Jul 10, 2008, 9:25:08 AM7/10/08
to Ruby on Rails: Spinoffs
@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

Vinicius Vacanti

unread,
Jul 14, 2008, 7:27:00 PM7/14/08
to Ruby on Rails: Spinoffs
This solved my problem. Thanks!
Reply all
Reply to author
Forward
0 new messages