Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-DOM subset of jQuery

I'd like to be able to use a number of utility methods from jQuery in a Web Worker, where there is no access to the window or document objects.

Specifically, I'd like to be able to use methods like $.extend(), $.ajax(), and the entire $.Deferred() system. I obviously would not need any of the DOM traversal and manipulation methods, so I'm not looking for a solution like JSDOM.

I can extract the non-DOM portions of jQuery myself, but this is a pain to maintain. Are there any available distributions or build scripts for jQuery that just build the non-DOM portions?

like image 679
kpozin Avatar asked Oct 25 '22 04:10

kpozin


1 Answers

My answer: https://github.com/kpozin/jquery-nodom.

So far, I have it working and tested with $.Deferred() and a subset of $.ajax() inside of a Web Worker context. Documentation and possible test suites coming later.

An initial test build is available: jquery.nodom.js

like image 180
kpozin Avatar answered Oct 27 '22 10:10

kpozin