Re: Custom Elements: "createdCallback" & cloning

On 07/13/2015 09:22 AM, Anne van Kesteren wrote:
> On Sun, Jul 12, 2015 at 9:32 PM, Olli Pettay <olli@pettay.fi> wrote:
>> Well, this printing case would just clone the final flattened tree without
>> the original document knowing any cloning happened.
>> (scripts aren't suppose to run in Gecko's static clone documents, which
>> print preview on linux and Windows and printing use)
>>
>> If one needs a special DOM tree for printing, beforeprint event should be
>> used to modify the DOM.
>
> Sure, but you'd lose some stuff, e.g. <canvas>, and presumably custom
> elements if they require copying some state, due to the cloning.
> (Unless it's doing more than just cloning.)
>
>

Clone-for-printing takes a snapshot of canvas and animated images etc.

And what state from a custom element would be needed in static clone document?
If the state is there in original document, and the state is somehow affecting layout, it should be
copied (well, not :focus/:active and such).

Anyhow, I see clone-for-printing very much an implementation detail, and wouldn't be too worried about it here.
There is enough to worry with plain normal element.cloneNode(true); or selection/range handling.



-Olli

Received on Monday, 13 July 2015 09:42:50 UTC