Hey Kangax,

Thank you for the reply.
Do you think the reason of the problem I met is because of using <div/>
instead of <div></div> ?
is Using </div> prohibitted? Do you know why it happns?

Also, good to know how to use Element.down().

Thanks!
Nori

2009/1/12 kangax <kan...@gmail.com>

>
> On Jan 12, 11:32 am, Nori <norisu...@gmail.com> 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 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