Google Groups Home
Help | Sign in
Message from discussion Safari 3.1 and getElementsByClassName
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Steve Upton  
View profile
 More options Mar 25, 1:53 pm
From: Steve Upton <clang...@gmail.com>
Date: Tue, 25 Mar 2008 10:53:45 -0700
Local: Tues, Mar 25 2008 1:53 pm
Subject: [Rails-spinoffs] Re: Safari 3.1 and getElementsByClassName

At 12:04 AM +0100 3/25/08, Peter De Berdt wrote:

>Just use $A(document.getElementsByClassName('foo')) instead of document.getElementsByClassName('foo') and you will have an array of extended elements, which is what you probably want. Simple workaround and haven't had any problems with it yet, both on Safari 3.1 and Firefox 3 beta (which also implements a native getElementsByClassName.

This is a good thing to know but Safari 3.1's new implementation of getElementsByClassName does not seem to use the parentElement parameter so I get elements for the whole page... not what I needed.

At 4:03 PM -0600 3/24/08, Dan Dorman wrote:

>On Mon, Mar 24, 2008 at 4:02 PM, Dan Dorman <dan.dor...@gmail.com> wrote:
>>  $('node-id').select('class-name');

>Oops:  $('node-id').select('.class-name');

yep, .select did it.

For the record, I changed:

elms = document.getElementsByClassName('classname',parentElement);

into

elms = $(parentElement).select('.classname');

The $ is handy when the element isn't yet extended OR is an id and don't forget to put the '.' in front of the class name to make it a class selector.

Thanks for your help.

Regards,

Steve

________________________________________________________________________
o  Steve Upton              CHROMiX        www.chromix.com
o   (hueman)                               866.CHROMiX
________________________________________________________________________
--


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google