Google Groups Home
Help | Sign in
Safari 3.1 and getElementsByClassName
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
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 24, 6:00 pm
From: Steve Upton <clang...@gmail.com>
Date: Mon, 24 Mar 2008 15:00:25 -0700
Local: Mon, Mar 24 2008 6:00 pm
Subject: Safari 3.1 and getElementsByClassName

Safari 3.1 implements its own getElementsByClassName and messes up Prototype.

A short summary is available here:

<http://blog.caboo.se/articles/2008/3/21/safari-3-1-breaks-your-app>

The above blog entry suggests substituting $$ for getElementsByClassName as a work-around and I see that the Prototype documentation lists getElementsByClassName as "deprecated".

My problem is that I use the 'parentElement' option in Prototype's getElementsByClassName fairly often so $$ is not an effective substitution.

So, is there a variation on $$ that constrains the search to a specific node?

I have yet to hear a comment on this list regarding Safari 3.1's change and how it affects Prototype. Am I the only one feeling this pain. This broke our site in a few important ways...

Is there a short-term hack I can apply to Prototype to get it to allow me to use Safari's getElementsByClassName (which appears to support the parentElement option)?

Is there something I'm missing here?

Regards,

Steve Upton

--


    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.
Dan Dorman  
View profile
 More options Mar 24, 6:02 pm
From: "Dan Dorman" <dan.dor...@gmail.com>
Date: Mon, 24 Mar 2008 16:02:50 -0600
Local: Mon, Mar 24 2008 6:02 pm
Subject: Re: [Rails-spinoffs] Safari 3.1 and getElementsByClassName

On Mon, Mar 24, 2008 at 4:00 PM, Steve Upton <clang...@gmail.com> wrote:
>  So, is there a variation on $$ that constrains the search to a specific node?

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

:Dan


    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.
Dan Dorman  
View profile
 More options Mar 24, 6:03 pm
From: "Dan Dorman" <dan.dor...@gmail.com>
Date: Mon, 24 Mar 2008 16:03:36 -0600
Local: Mon, Mar 24 2008 6:03 pm
Subject: Re: [Rails-spinoffs] Safari 3.1 and getElementsByClassName

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');

Sorry!

:Dan


    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.
Peter De Berdt  
View profile
(1 user)  More options Mar 24, 7:04 pm
From: Peter De Berdt <peter.de.be...@pandora.be>
Date: Tue, 25 Mar 2008 00:04:37 +0100
Local: Mon, Mar 24 2008 7:04 pm
Subject: Re: [Rails-spinoffs] Safari 3.1 and getElementsByClassName

On 24 Mar 2008, at 23:00, Steve Upton 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.

Best regards

Peter De Berdt


    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.
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.
RobG  
View profile
 More options Mar 25, 10:47 pm
From: RobG <rg...@iinet.net.au>
Date: Tue, 25 Mar 2008 19:47:32 -0700 (PDT)
Local: Tues, Mar 25 2008 10:47 pm
Subject: Re: Safari 3.1 and getElementsByClassName

On Mar 26, 3:53 am, Steve Upton <clang...@gmail.com> wrote:

> 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.

Read the doco - it doesn't need to, it's implemented as per the HTML 5
working draft on the HTMLElement interface, it is called as a method
of the "parentElement":

  var liveNodeList = parentElement.getElementsByClassName('foo bar
tweedle dee ...');

<URL: http://www.w3.org/html/wg/html5/#getelementsbyclassname >

--
Rob


    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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