Open stevesims opened 13 years ago
Alright. I'll see what I can do.
Ah, you're getting a DOM Level 1 from JSDOM -- Level 2 is required to get doctypes right, I think.
What I end up getting is TypeError: Object #<Object> has no method 'createDocumentType'
running your code.
I'm working with @tmpvar and @isaacs to get npm
and/or jsdom
to export the level 2 stuff more easily to fix this properly.
I must admit that I struggled quite a bit to get html5 up and running - I've been doing browser-based JS for years, but am fairly new to node.js. It took me a while to figure out that I needed to set up a NODE_PATH environment variable to point to places where npm was installing things, otherwise html5 was just refusing to see jsdom at all. (Getting document.querySelector was important for me - I only managed to work that out by searching through jsdom's test code...) Chances are I've not got things set up quite "right", which probably explains why we're seeing differing results.
For now I've worked around this problem by using a regex to move the doctype from the end of the outputted HTML to the beginning.
I'll keep an eye out for updates - would be nice to remove my bodge. :-)
Sweet. I'll keep working on the integration issues. It's mostly about getting jsdom's API to be more friendly to use via npm. I'll see about that!
yeah, to be honest jsdom is pretty hosed on my local machine. I'll spend some time getting back to "a good place" this weekend
Awesome! Poke me by twitter if you want help testing anything.
If I try to serialize out a document, html5 is outputting the doctype at the end, rather than the beginning.
My simple-ish test-case code is:
What I see outputted to console is: