Re: [whatwg] <iframe async>

On 27 Feb 2015 at 19:38, Boris Zbarsky <bzbarsky@mit.edu> wrote: 

> On 2/27/15 2:18 PM, Tim Streater wrote:
>> One thing I'd like would be to be able to put content into an iframe (and
>> thus have it parsed), but defer any rendering or speculative download of
>> resources referred to in the content.
>
> Depending on whether you care about the href of your iframe and whether
> you want it sandboxed and so forth:
>
> var parsedThing =
>   new DOMParser().parseFromString(myString, "text/html");

Yes, already doing this.

> // Process parsedThing however you want.
> myIframe.contentDocument.replaceChild(
>   parsedThing.documentElement,
>   myIframe.contentDocument.documentElement
> );

Thanks, I'll try this instead of:

  myIframe.write (new XMLSerializer().serializeToString (parsedThing));

which I'm doing at present :-)

--
Cheers  --  Tim

Received on Friday, 27 February 2015 22:27:38 UTC