Browsers won't let you insert broken HTML, so when you do:

$("myElement").insert({before: '<span>'});

the browser (not Prototype) actually transforms that to something like
this:

$("myElement").insert({before: '<span></span>'});

Hence your issues.

Best,

Tobie

On Feb 14, 5:12 pm, ohneworte <[EMAIL PROTECTED]> wrote:
> Hello together,
>
> I figured out a strange and - in my opinion - wrong behaviour in the
> Prototype function "Element.insert": There´s a simple <span>-Element
> somewhere in my website. Now I want to put another <span> Element
> around it (and I don´t want to use the "wrap"-method!!). So I am doing
> something like this:
>
> My Html:
> <span id="myElement"></span>
>
> My JavaScript:
> $("myElement").insert({before: '<span>'});
> $("myElement").insert({after: '</span>'});
>
> In the generated source-code it leads to:
> <span/>
> <span id="myElement"></span>
>
> So the new <span>-Tag is inserted before the element. Anyone an idea
> why?
>
> Best regards!
--~--~---------~--~----~------------~-------~--~----~
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