giacomodeliberali / node-jquery

Use jQuery in node with jsDOM window mock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JQuery for Node

For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as jsDOM.

This library mocks the window with the one provided by jsDOM, making available Jquery (3.3.1) in node, for testing or parsing purposes.

Install

To include jQuery in Node, install with npm:

npm install jquery-jsdom

jQuery (3.3.1) and jsDOM are already included as dependencies and do not need to be included separately.

Usage

Typescript

import $ from 'jquery-jsdom';

$("<a>DOM</a>").html(); // "DOM"

Javascript

const $ = require('jquery-jsdom');

$("<a>DOM</a>").html(); // "DOM"

About

Use jQuery in node with jsDOM window mock

License:MIT License


Languages

Language:HTML 73.0%Language:TypeScript 22.0%Language:JavaScript 5.1%