Matthias Buchetics
2006-Jan-13 03:19 UTC
Effect together with ...firstChild - can''t get it to work
Hi, I am relatively new to Rails and I can''t get the following to work: what I am trying to do is to make the first item of a list to flash: var item = $(''items'').firstChild; new Effect.Highlight(item); I get the this Javascript error message: this._base has no child (effects.js, line 445) But I am able to do this without any problems: var item = $(''items''); new Effect.Highlight(item); (now the whole list flashes) My list looks like that: <ul id="items"> <li>test1</li> <li>test2</li> <li>test3</li> </ul> Thank you very much in advance, Matthias
David Goodlad
2006-Jan-13 03:45 UTC
Re: Effect together with ...firstChild - can''t get it to work
On 1/12/06, Matthias Buchetics <mbuchetics-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I am relatively new to Rails and I can''t get the following to work: > what I am trying to do is to make the first item of a list to flash: > > var item = $(''items'').firstChild; > new Effect.Highlight(item); > > I get the this Javascript error message: > this._base has no child (effects.js, line 445) > > But I am able to do this without any problems: > var item = $(''items''); > new Effect.Highlight(item); > (now the whole list flashes) > > My list looks like that: > <ul id="items"> > <li>test1</li> > <li>test2</li> > <li>test3</li> > </ul> > > Thank you very much in advance, > MatthiasHi Matthias If you''re using a Mozilla-based browser, the firstChild call is probably returning an empty text node. Moz inserts these all over the place - you can check with the DOM inspector under the ''Tools'' menu. Try using a different method to get at the children; enumerating and checking what type they are might be a way to do it, but it depends on your ultimate goal. Hope that helps! Dave -- Dave Goodlad dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or dave-eHfbeeWWzZOw5LPnMra/2Q@public.gmane.org http://david.goodlad.ca/
Matthias Buchetics
2006-Jan-13 09:22 UTC
Re: Effect together with ...firstChild - can''t get it to work
Thank you very much for the hint. The following code worked: new Effect.Highlight($(''items'').getElementsByTagName(''li'')[0]); Thanks again, Mat On 1/13/06, David Goodlad <dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/12/06, Matthias Buchetics <mbuchetics-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > I am relatively new to Rails and I can''t get the following to work: > > what I am trying to do is to make the first item of a list to flash: > > > > var item = $(''items'').firstChild; > > new Effect.Highlight(item); > > > > I get the this Javascript error message: > > this._base has no child (effects.js, line 445) > > > > But I am able to do this without any problems: > > var item = $(''items''); > > new Effect.Highlight(item); > > (now the whole list flashes) > > > > My list looks like that: > > <ul id="items"> > > <li>test1</li> > > <li>test2</li> > > <li>test3</li> > > </ul> > > > > Thank you very much in advance, > > Matthias > > Hi Matthias > > If you''re using a Mozilla-based browser, the firstChild call is > probably returning an empty text node. Moz inserts these all over the > place - you can check with the DOM inspector under the ''Tools'' menu. > > Try using a different method to get at the children; enumerating and > checking what type they are might be a way to do it, but it depends on > your ultimate goal. > > Hope that helps! > Dave > > > -- > Dave Goodlad > dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or dave-eHfbeeWWzZOw5LPnMra/2Q@public.gmane.org > http://david.goodlad.ca/ > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Marco M. Jaeger
2006-Jan-13 11:15 UTC
RE: Effect together with ...firstChild - can''t getit to work
Maybe this would work too: Element.cleanWhitespace(''items''); var item = $(''items'').firstChild; -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Matthias Buchetics Sent: Friday, January 13, 2006 10:23 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] Effect together with ...firstChild - can''t getit to work Thank you very much for the hint. The following code worked: new Effect.Highlight($(''items'').getElementsByTagName(''li'')[0]); Thanks again, Mat On 1/13/06, David Goodlad <dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/12/06, Matthias Buchetics <mbuchetics-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > I am relatively new to Rails and I can''t get the following to work: > > what I am trying to do is to make the first item of a list to flash: > > > > var item = $(''items'').firstChild; > > new Effect.Highlight(item); > > > > I get the this Javascript error message: > > this._base has no child (effects.js, line 445) > > > > But I am able to do this without any problems: > > var item = $(''items''); > > new Effect.Highlight(item); > > (now the whole list flashes) > > > > My list looks like that: > > <ul id="items"> > > <li>test1</li> > > <li>test2</li> > > <li>test3</li> > > </ul> > > > > Thank you very much in advance, > > Matthias > > Hi Matthias > > If you''re using a Mozilla-based browser, the firstChild call is > probably returning an empty text node. Moz inserts these all over the > place - you can check with the DOM inspector under the ''Tools'' menu. > > Try using a different method to get at the children; enumerating and > checking what type they are might be a way to do it, but it depends on > your ultimate goal. > > Hope that helps! > Dave > > > -- > Dave Goodlad > dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or dave-eHfbeeWWzZOw5LPnMra/2Q@public.gmane.org > http://david.goodlad.ca/ > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
This is from the macrumors site that posted the macworld update: "In short, we peaked at approximately 103,000 simultaneous web visitors and over 6,000 IRC viewers during the keynote speech and consumed over 32 GB of bandwidth during the three hours surrounding the event. (For those interested, a non-AJAX version of MacRumorsLive would have required an estimated 196 GB of bandwidth over the same period of time)." We, of course, are seeing bandwidth reduction, but it is great to see some published numbers! Deco _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Excuse me while my jaw drops... Thats amazing, I never realized Ajax could make such a difference! and I love scriptaculous for making it so very easy! Keep up the great work everybody. On 1/13/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote:> > This is from the macrumors site that posted the macworld update: > > "In short, we peaked at approximately *103,000* simultaneous web visitors > and over *6,000* IRC viewers during the keynote speech and consumed over > 32 GB of bandwidth during the three hours surrounding the event. (For those > interested, a non-AJAX<http://www.macrumors.com/c.php?u=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FAJAX>version of MacRumorsLive would have required an estimated 196 GB of > bandwidth over the same period of time)." > We, of course, are seeing bandwidth reduction, but it is great to see some > published numbers! > > Deco > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >-- ===========================Brian Peiris Brampton, Ontario, Canada brianpeiris-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or brianpeiris-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org =========================== _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs