[Proto-Scripty] Re: Each Not Working with getElementsByTagName

2008-12-01 Thread Jonathan Rosenberg

Assuming you really want the $ as part of the variable name, this should be:

var $aCSS = $A(document.getElementsByTagName('style'));


 -Original Message-
 From: prototype-scriptaculous@googlegroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of laurin1
 Sent: Monday, December 01, 2008 16:15
 To: Prototype  script.aculo.us
 Subject: [Proto-Scripty] Each Not Working with getElementsByTagName
 
 
 var $aCSS = document.getElementsByTagName('style');
 
 $aCSS.each(function($sEle){
 
   alert('test');
 
 });
 
 I can make this work with $$, and if I use
 document.getElementsByTagName('style')[0], I can access each one
 individually. So why can't I use each()?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Each Not Working with getElementsByTagName

2008-12-01 Thread Jarkko Laine

On 1.12.2008, at 23.14, laurin1 wrote:


 var $aCSS = document.getElementsByTagName('style');

 $aCSS.each(function($sEle){

   alert('test');

 });

 I can make this work with $$, and if I use
 document.getElementsByTagName('style')[0], I can access each one
 individually. So why can't I use each()?

Because HTMLCollection (which getElementsByTagName returns) doesn't  
mix in Enumerable, where each comes from.

The question is, why would you use getElementsByTagName?

//jarkko

--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://odesign.fi

Check out my latest book, Unobtrusive Prototype, fresh off the  
Peepcode oven:
http://peepcode.com/products/unobtrusive-prototype-js


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Each Not Working with getElementsByTagName

2008-12-01 Thread laurin1

I was under the impression that $$ was not very efficient, or do you
mean there is another way that I am overlooking?

On Dec 1, 3:25 pm, Jarkko Laine [EMAIL PROTECTED] wrote:
 On 1.12.2008, at 23.14, laurin1 wrote:



  var $aCSS = document.getElementsByTagName('style');

  $aCSS.each(function($sEle){

     alert('test');

  });

  I can make this work with $$, and if I use
  document.getElementsByTagName('style')[0], I can access each one
  individually. So why can't I use each()?

 Because HTMLCollection (which getElementsByTagName returns) doesn't  
 mix in Enumerable, where each comes from.

 The question is, why would you use getElementsByTagName?

 //jarkko

 --
 Jarkko Lainehttp://jlaine.nethttp://dotherightthing.comhttp://odesign.fi

 Check out my latest book, Unobtrusive Prototype, fresh off the  
 Peepcode oven:http://peepcode.com/products/unobtrusive-prototype-js
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Each Not Working with getElementsByTagName

2008-12-01 Thread kangax

On Dec 1, 7:03 pm, Jerod Venema [EMAIL PROTECTED] wrote:
 It previously had some performance issues, but now that should not be
 noticeable.

Actually, `getElementsByTagName` is still marginally faster than `$$`
in slower engines (e.g. IE).

[...]

 --
 Jerod Venema
 Frozen Mountain Softwarehttp://www.frozenmountain.com/
 919-368-5105

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---