Use an <iframe> for preview, for correctness and isolation
authorPhilip Jägenstedt <philip@foolip.org>
Sun, 3 Jul 2011 21:28:53 +0000 (23:28 +0200)
committerPhilip Jägenstedt <philip@foolip.org>
Sun, 3 Jul 2011 21:28:53 +0000 (23:28 +0200)
commitcb4591aa16687b1d520617ec5d36079b5e7f55fb
tree86ca73510f275577a1d585a1e8418070b87521f9
parent34bab5289b3e71f8b8940c58b0b13818b63db5bb
Use an <iframe> for preview, for correctness and isolation

Previously, innerHTML was used to show the preview in a <div>, but this
breaks down if the markup being tested has scripts, CSS, <body> elements
or other things that interfere with the tool itself.

Thanks to the reporters:
Dan Brickley: http://krijnhoetmer.nl/irc-logs/whatwg/20110609#l-284
Gregg Kellogg: https://twitter.com/#!/Gkellogg/status/84300519455203328

The technique of document.write()'ing in a same-origin iframe was stolen
from http://software.hixie.ch/utilities/js/live-dom-viewer/
jquery.microdata.rdf.js
live/index.html
live/live.css
live/live.js