hasharray / liveflow.js

Live Editing for Node.js and Browsers
https://liveflow.js.org
15 stars 2 forks source link

Use <plaintext> to preprocess the document #23

Closed caspervonb closed 8 years ago

caspervonb commented 8 years ago

Currently I'm trying to emulate beforescriptexecute with some hackery of calling window.stop, which leads to a bunch of problems cross-browser issues as stop doesn't behave the same in gecko and webkit.

Earlier on I was using <template> tags to render the document inert, but those translate into document fragments which eat up <head> and <body>.

What we actually want here, is to switch the tokenizer into a raw form, so we can just preprocess the document content before doing another document.write.

Reading through the 5.1 specification, <plaintext> is very clearly there, and even better is this part

Once a start tag with the tag name "plaintext" has been seen, that will be the last token ever seen other than character tokens (and the end-of-file token), because there is no way to switch out of the PLAINTEXT state.

caspervonb commented 8 years ago

Added in https://github.com/hasharray/thingamajig.js/commit/d9ffdcadbcd761bcdab403e082b36f367d6a57d1, as a bonus, selenium works just fine now.