On Jan 12, 11:32 am, Nori <[email protected]> wrote:
> Hi there,
>
> I was using Element.insert(), and found something weird.
>
> I wanted to put a text node 'test' into a div#foo in the follwoing
> xml.
>
> <temp>
> <div id="foo"/>
> <div id="bar"/>
> <temp>
I'm not sure which xml namespaces are declared in the document, but
I'm sure you know that <temp> is an invalid element in both HTML4.01
and XHTML1.1.
>
> And, tried to run the following code in a Firebug console.
>
> var temp = new Element('temp').insert('<div id="foo"/><div id="bar"/>');
>
> var foo = $A(temp.getElementsByTagName('div')).find(function(e)
> {console.log(e.id);return e.id=="foo"});
> foo.insert('test');
>
> var serializer = new XMLSerializer();
> serializer.serializeToString(temp);
>
Try:
var temp = new Element('temp').insert('<div id="foo"></div><div
id="bar"></div>');
$(temp).down('div[id=foo]').update('blah');
var serializer = new XMLSerializer();
serializer.serializeToString(temp);
[...]
--
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---