Hi,

class is a reserved keyword in JavaScript.

Prototype supports the two following notations:

new Element('div', {'class': 'cls'});
new Element('div', {className: 'cls'});

Regards,

Tobie


On Nov 7, 12:06 pm, "Alex MacCaw" <[EMAIL PROTECTED]> wrote:
> Ok, it seems that I've been barking up the wrong tree. new Element('div')
> works in safari (if you specify the right content-type), but new
> Element('div', {class: 'cls'}) doesn't. I presume Safari uses 'class' for
> something else? Anyways, I now have a new problem, but I'll post that in a
> separate thread.
> Thanks
> Alex
>
> On Nov 6, 2007 3:25 PM, Ed C. <[EMAIL PROTECTED]> wrote:
>
>
>
> > Take a look at the content-type header being sent by your web server,
> > and/or adding a meta tag to your header and "hard coding" the content-type.
>
> > On 11/6/07, RobG <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 6, 5:42 pm, Alex MacCaw <[EMAIL PROTECTED]> wrote:
> > > > I'm encountering quite a weird problem with Safari 2.0.4 - 'new
> > > > Element' doesn't work at all, *unless* you change the file extension
> > > > of the document you're loading from xhtml to html.
>
> > > It seems that Safari uses the file extension rather than the DOCTYPE
> > > declaration.  If you serve your file to Safari as XHTML, I suspect you
> > > will get the same result.
>
> > > Safari does not appear to support the (non-standard) innerHTML
> > > property for dynamically created elements in XML documents.  If you
> > > try something like:
>
> > > alert(typeof newelem.innerHTML)
>
> > > you will get 'undefined', whereas 'string' would be expected if the
> > > innerHTML property was supported (and that is the result for an HTML
> > > document).
>
> > > [...]
> > > > Does anyone know what the problem is? It seems a fairly fundamental
> > > > issue with Safari & Prototype.
>
> > > Yes, it does, since Prototype is very dependent on innerHTML.  But
> > > then again, using XHTML on the web is pretty much a complete waste of
> > > time.
>
> > > Incidentally, your document is not a valid XHTML document anyway, so
> > > strictly, if served as application/XML, the result should be an error
> > > message .
>
> > > --
> > > Rob
>
> --http://www.eribium.org|http://juggernaut.rubyforge.org|http://www.aireofs.com|
>  Skype: oldmanorhouse


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to