Because prototype was released before IE8 and its alot of hack to get the 
new versions to do this for you.

Just do
$('lineup').appendChild(new Element('li', {'class' : 'ghost'}));
var elem=$('lineup').down('.li'); // untested and better if your <li> has an 
id really
elem.addClassName('ghost');

and alll will be fine...

Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- 
From: "JoJo" <tokyot...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Tuesday, September 01, 2009 7:53 AM
Subject: [Proto-Scripty] Re: Pure Prototype code was incompatible with IE8.



I'm wondering why Internet Explorer was not mentioned in
http://www.prototypejs.org/api/element in that example creating the
element with the class.

I'm curious why Prototype doesn't just add the class for me behind the
scenes...

On Aug 31, 11:09 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> Because IE8 does not add the classname to the element when using new
> Element. It is a well documented bug in IE8 and you need to use
> addClassName('ghost') after the new Element bit
>
> HTH
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> ----- Original Message -----
> From: "Mojito" <tokyot...@gmail.com>
> To: "Prototype & script.aculo.us" 
> <prototype-scriptaculous@googlegroups.com>
> Sent: Monday, August 31, 2009 9:51 PM
> Subject: [Proto-Scripty] Pure Prototype code was incompatible with IE8.
>
> > My site works fine in FF and Safari. When tested with IE8, I get some
> > error. It says "ghost" and "ghostPosition" are undefined. Why is my
> > code incompatible with IE8 if my DOM reading and writing are purely
> > done with Prototype?
>
> > ++++++++++++++++++++++++++++++++++
>
> > if($$('#lineup .ghost').length === 0)
> > {
> > $('lineup').appendChild(
> > new Element('li', {'class' : 'ghost'})
> > );
> > }
>
> > var ghost = $$('#lineup .ghost')[0];
> > var ghostPosition = ghost.cumulativeOffset();



--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to