There is no universal parent, not while there are tr, td, th, li, etc. in the
mix of possible children. There are quite a few low-level elements that can
only go in one or two possible parent tags, and nothing else will work.
Walter
On Nov 30, 2011, at 11:09 AM, vhochstein wrote:
> Hi,
>
> Unfortunetly, I had to realize that my approach does not work in any
> every case.
>
> var new_element = new Element('div').update('<tr></tr>'); fails. tr
> Tag is not added to div
>
> I think update function checks if tr elements are allowed inside of
> div elements, cause
> new Element('tbody').update('<tr></tr>'); works as aspected.
>
> Does anybody if there exists a tag which can be updated with any html
> code?
>
> Thanks a lot in advance.
>
> --
> Volker
>
>
>
>
>
> On 5 Nov., 10:58, vhochstein <[email protected]> wrote:
>> Hi
>>
>> Thanks a lot for your help.
>>
>> I slightly changed it:
>> var new_element = new Element('div').update(html);
>> new_element = new_element.firstDescendant();
>> Element.replace(old_element, new_element);
>>
>> --
>> Volker
>>
>> On 4 Nov., 23:31, "T.J. Crowder" <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> On Nov 4, 5:30 pm, vhochstein <[email protected]> wrote:
>>
>>>> Hi,
>>
>>>> if I call old_element = Element.replace(element, 'html code for new
>>>> element')
>>>> I get the old_element in response.
>>
>>>> How may I get the new_element node if it does nt have an id attribute?
>>
>>>> Thanks a lot in advance.
>>
>>>> --
>>>> Volker
>>
>>> Well, you could find it through the hierarchy or some such, but
>>> probably the easiest thing is to get a reference to it *before* you
>>> replace it:
>>
>>> var new_element = new Element('tagName').update('contents');
>>> Element.replace(old_element, new_element);
>>
>>> Live example:http://jsbin.com/uwibuh
>>
>>> HTH,
>>> --
>>> T.J. Crowder
>>> Independent Software Engineer
>>> tj / crowder software / com
>>> www / crowder software / com
>
> --
> 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.
>
--
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.