Node.js Question:
Download Questions PDF

Can we use jQuery with Node.js?


No. It's going to be quite a big effort to port a browser environment to node.

Another approach, that I'm currently investigating for unit testing, is to create "Mock" version of jQuery that provides callbacks whenever a selector is called.

This way you could unit test your jQuery plugins without actually having a DOM. You'll still have to test in real browsers to see if your code works in the wild, but if you discover browser specific issues, you can easily "mock" those in your unit tests as well.

I'll push something to once it's ready to show.

Download Node.js Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me how to decide when to use Node.js?How to extract POST data in node.js?