kpozin
kpozin

Reputation: 26939

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?

Upvotes: 5

Views: 2223

Answers (2)

kpozin
kpozin

Reputation: 26939

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

Upvotes: 3

Gabriel
Gabriel

Reputation: 18780

so jQuery is open source, you could easily clone the git repo, create a build repo that plucks the parts you like (I believe jQuery development is broken up into modules) and just revise the build system as you keep your jQuery clone up to date. You could then open source that sucker and solve this problem for good. It looks like someone has already maybe addressed this particular question in this thread.

Upvotes: 0

Related Questions