Re: [CSS3] Content to appear twice

Matthias P. Wuerfl wrote:
> 
> 
> 
> Ian Hickson wrote:
> 
>> How would you cope with the following case?:
>>
>>    <applet src="some-plugin" id="foo"/>
>>    <div/>
>>    <div/>
>>
>> ...with:
>>
>>    div { duplicate-the-element-here: 'foo'; }
>>
>> ...? 
> 
> 
> I don't know. Should I? :-) As far as i can focus on the problem as a 
> not-programmer and a just-web-author there are 3 possibilities:
> 
> 1 showing one applet twice (or thrice) (the Browser could simply "copy"
>   the "look" of the "area". Reaction on Input is shown thrice.)
> 2 having the applet thrice on the page (just as if it was 3 times in the
>   HTML-Source)
> 3 saying "this only works for ul, p, div,..." in the specs and waiting
>   for ideas to appear later.
> 
>> It also seems odd from a DOM point of view -- what's the offsetTop of a
>> <div> that is painted twice?
> 
> 
> My Idea was to have an "original" and a "copy". Of course those things 
> have to deal with the original. Sorry, but i don't know DOM good enough 
> to understand the problem.
> 
>> Yeah, that can be a problem... you could include the header twice 
> 
> [...]
> 
>> and define the header outside the markup. 
> 
> 
> That's what i don't want to. Things like the Naviation belong to the 
> HTML-Code. This works with all UAs. Solutions that are not compatible 
> with former standards (or Web Culture) are not acceptable for me as author.
> 
>  > That may be semantically better anyway, since the
> 
>> document navigation is not necessarily a part of the document itself in
>> many cases.
> 
> 
> In some. Maybe. But showing "where am i" and "where can i go" is an 
> essential part of web documents and other techniques are not commonly 
> supported. Copying with CSS could enhance diplaying on supporting 
> browsers (and only on the media where it makes sense) while not 
> affecting older browsers and other media.
> 
> Spoken from an authors point of view: Display-Property allows to display 
> elements 0 times and 1 time. Why not 2 times, 3 times,...?
> 
> Matthias
> 

Could dom node's cloneNode() method be applicable here?  Lets say the 
form you want to duplicate has a form id=navbar.  Set your onload in 
your body tag to target a good script function, and in that function, do 
something akin to this...

----
nb_clone = (document.getElementByID("navbar")).cloneNode(1);

(Here, one should ponder whether id/class collisions will cause style 
havoc. Using 'class' is best for the navbar, imho. Fix by adjusting all 
id's and/or classes down thru nb_clone's heirarchy and members)

document.body.appendChild(nb_clone);
----

I've never tried this... so I'm not responsible if a dom tree falls thru 
the roof of your apartment complex. :)

Received on Thursday, 4 December 2003 07:57:40 UTC