Code Monkey home page Code Monkey logo

Comments (7)

Munawwar avatar Munawwar commented on July 25, 2024

Is it ok if I update to jsdom 9.2.1?

from htmlizer.

Munawwar avatar Munawwar commented on July 25, 2024

Ok, now I remember why I didn't update jsdom.

Htmlizer relies on jQuery.parseHTML for parsing HTML string to DOM nodes.
Upgrading to jsdom 3.1.2 or higher makes jQuery.parseHTML removes doctype,html,body and head tags. On jsdom 0.10.3 jQuery.parseHTML removes doctype only. Upgrading jsdom would cause a regression for anyone parsing entire documents (like here).

As a workaround, now I detect if document begins with a <html> tag and then use a different parsing trick. The limitation are:

  1. you can't parse a template that begins with a head or body tag. They will have to be wrapped inside an html tag.
  2. An empty head tag will always be present when parsing an entire document (I can work around that as well, but didn't, as it won't cause much harm I guess).

Tell me if you are ok with the above limitations.

from htmlizer.

papandreou avatar papandreou commented on July 25, 2024

@mwoc, upgrading to htmlizer 2 should be far easier. It doesn't depend on jsdom at all (except as a dev dep), is faster and has the same API (iirc).

from htmlizer.

Munawwar avatar Munawwar commented on July 25, 2024

@mwoc Yea, very few things have changed in htmlizer2. From the README file:

1. toDocumentFragment() method has been removed.
2. $element KO binding context cannot be used anymore.
3. template binding interface has changed. (It has become simpler).

BTW, has anyone noticed that knockout itself can be run on node (by first declaring a global window and document object)? As far as I've tested it, even ko.observable and change updates also works.

from htmlizer.

mwoc avatar mwoc commented on July 25, 2024

I'll take a look at upgrading to v2 then. I think I tried while I was upgrading to node v6, and something else broke when using htmlizer, probably hitting one of the API changes. Will let you know how it goes this time :)

from htmlizer.

Munawwar avatar Munawwar commented on July 25, 2024

@mwoc Did you solve your issues with v2?

from htmlizer.

mwoc avatar mwoc commented on July 25, 2024

I'm working now on updating to v2, and ran into issue #22 which I now remember earlier was the reason why I wanted to stick to v0.x for now.

from htmlizer.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.