github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

thatcher / env-js forked from jeresig/env-js

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 153
    • 19
  • Source
  • Commits
  • Network (19)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • readme-tweak
  • Tags (1)
    • 1.0.0
Sending Request…
Click here to lend your support to: env-js and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A pure-JavaScript browser environment. — Read more

  cancel

http://ejohn.org/blog/bringing-the-browser-to-the-server/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

integration tests running for jquery 1.4.1, ends up with OutOfMemoryError 
on closest(div:first) 
thatcher (author)
Tue Feb 09 05:49:12 -0800 2010
commit  0c7976e30f0755adc4e3a57cd78e28d445709080
tree    0364e877cc8f8717733ca0f6bf8f38d0de12c7c3
parent  d3ef20e9336f4ab0e78321d8c5910c0deb2ed164
env-js /
name age
history
message
file .gitignore Tue Feb 02 06:00:57 -0800 2010 initial commit of refactor 1.2.0.x, see README.... [thatcher]
file .gitmodules Wed Nov 25 11:06:57 -0800 2009 remove un-subed qunit [smparkes]
file .project Wed May 20 06:54:39 -0700 2009 added xpath and xslt related stubs to satisfy p... [thatcher]
file Makefile Sun Aug 16 18:02:09 -0700 2009 did some refactoring of Glen E. Iveys substanti... [thatcher]
file README Wed Oct 28 18:34:31 -0700 2009 merge timer [smparkes]
file README.Refactor.txt Tue Feb 02 06:47:33 -0800 2010 removed unsafe references to local_settings.js [thatcher]
file Rakefile Sun Aug 16 18:02:09 -0700 2009 did some refactoring of Glen E. Iveys substanti... [thatcher]
directory bin/ Tue Feb 09 05:49:12 -0800 2010 integration tests running for jquery 1.4.1, end... [thatcher]
file build.properties Tue Feb 02 06:00:57 -0800 2010 initial commit of refactor 1.2.0.x, see README.... [thatcher]
file build.xml Mon Feb 08 09:36:34 -0800 2010 concatenated modules out of order, corrected [thatcher]
directory dist/ Tue Feb 09 05:49:12 -0800 2010 integration tests running for jquery 1.4.1, end... [thatcher]
directory doc/ Thu Aug 20 07:26:23 -0700 2009 found some good little bugs in node insertBefor... [thatcher]
directory htmlparser/ Tue Feb 02 06:00:57 -0800 2010 initial commit of refactor 1.2.0.x, see README.... [thatcher]
directory jsl/ Thu Jan 15 13:28:15 -0800 2009 oops I think I just commited incorrectly [thatcher]
directory licenses/ Tue Aug 25 21:56:29 -0700 2009 merging glens envjs.main changes. used in comb... [thatcher]
directory rhino/ Wed Oct 14 19:29:13 -0700 2009 Added support for the "quit" command/function p... [gleneivey]
file settings.js Thu Feb 04 15:22:01 -0800 2010 fixed build process so developers can have loca... [thatcher]
directory src/ Tue Feb 09 05:49:12 -0800 2010 integration tests running for jquery 1.4.1, end... [thatcher]
directory test/ Tue Feb 09 05:49:12 -0800 2010 integration tests running for jquery 1.4.1, end... [thatcher]
README
env.js : A pure JavaScript browser environment.
Developed by John Resig (http://ejohn.org)

Major Contributers:
Chris Thatcher (http://github.com/thatcher)

GitHub repositories:
http://github.com/jeresig/env-js/
http://github.com/thatcher/env-js/

Mailing List:
http://groups.google.com/group/envjs

Lighthouse (Bug Tracking):
http://envjs.lighthouseapp.com/projects/21590-envjs/

Build Status:
http://runcoderun.com/thatcher/env-js

Original blog post:
http://ejohn.org/projects/bringing-the-browser-to-the-server/

Rhino (Java-based JavaScript engine)
http://www.mozilla.org/rhino/

Getting the code:

* Check the code out from git: git clone git://github.com/thatcher/env-js.git

Building:
* run "ant concat"
* Creates a platform-agnostic "dist/env.js" file and a Rhino-specific "dist/env.rhino.js" file.

Testing:
* Checkout qunit: "git submodule update --init"
* run "ant test"

Java command line:

env.rhino.js can be run either with a "generic" version of the Rhino
library (js.jar), or with the repackaged/extended version of Rhino
supplied with env.js (env-js.jar).  If your application uses multiple
windows, frames, or iframes, or if it depends on precise adherence to
JavaScript object scoping in event handlers, you will have to use
env-js.jar.  Simple applications may be able to run with the generic
version of Rhino.

The command line used for testing env.js can be found in build.xml,
although the general form is:
     java -jar [jar file] [javascript file]
Where "jar file" is either "dist/env-js.jar", "rhino/js.jar", or your
local path to a different version of the Rhino js.jar file.  The
"javascript file" is the path to the JavaScript you wish to execute.

Installing:
1) Include the proper env.js file for your platform.
     load('env.rhino.js'); //if in a Rhino script

2) Tell env.js to load an HTML file from your file system that it should model:
     Envjs("some/file.html");
       or
     var someWindow = window.open("some/file.html");
       or
     window.location = "some/file.html";

   Optionally you can turn on/off settings by passing an options object:
     Envjs("some/file.html", {log: function(msg){ console.debug(msg) }});

3) Optionally trigger "document ready" events in one of these ways:

4) Start processing of window(s)' event queue:
     Envjs.wait();

All together, the steps could be:

   a) simplest method:
     load('env.rhino.js');
     Envjs("some/file.html");
     Envjs.wait();

   b) jQuery ready method:
     load('env.rhino.js');
     load('jquery-1.3.2.js');
     Envjs("some/file.html");
     load('some-code-that-sets-up-jquery-onready-behaviors.js')
     jQuery.ready();
     Envjs.wait();

   c) Other JavaScript frameworks have their own methods of setup, but the general pattern is:
     // step 1: load env.js
     // optionally: load your framework(s)
     // step 2: tell env.js the base DOM to model
     // optionally: run any setup code for your framework(s0
     // step 3: tell the framework that the document is loaded
     // step 4: Envjs.wait();

Note that env.js is currently limited to loading a single HTML page
from the original window.  If you are going to load multiple pages in
succession into the same window, load the first into a new window
object using window.open().

Testing jQuery Compatibility:
* run ./bin/test-jquery.sh 1.3.2
* run ./bin/test-jquery.sh 1.3.1
* run ./bin/test-jquery.sh 1.2.6
* Checks out the given jQuery tag from Subversion into test/vendor/jQuery/[version], 
  moves dist/env.rhino.js into the correct location in their tree, and runs the test suites.

Changes with new timer code:

Previously with envjs, you could call Java's thread sleep() method to delay execution. This was mostly used in test 
suites. This may no
longer work the same since it will inhibit all events from firing. You can now use the Envjs.wait(milliseconds) call to 
achieve an
effect similar to calling sleep().
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server