github says 407 bytes... how is he doing that?? my HTML / CSS is nowhere near that level
- There are textareas for each language
- Through event bubbling, one can listen to events on all of those with just 1 handler
- Elements with an `id` attribute have a corresponding property in the `window` (global scope), so you don't need to query for them.
With those facts, the code just listens to every change on any field, and assembles a (technically invalid, but in practice functional) HTML snippet, which is just:
(contents of the HTML box)
<style>(contents of the CSS box)</style>
<script>(contents of JS box)</script>
And pastes it into the iframe's content.Not particularly efficient, but pretty good for <400b