-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f2191d
commit 49b0451
Showing
212 changed files
with
45 additions
and
169,090 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,45 @@ | ||
# jsdom | ||
|
||
CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications. | ||
|
||
Currently Implemented and w3c Compliant: | ||
|
||
- DOM Level 1 (html/svg/xml) | ||
- Browser (BOM) Augmentation (getElementsByClassName, getElementById, etc..) | ||
|
||
|
||
**Note**: Running the tests now requires [mjsunit.runner][] | ||
|
||
see: [testlog][] for w3 test compliance | ||
|
||
see: [plan][] for roadmap and thoughts about this project | ||
|
||
see: [project site][] for additional information | ||
|
||
[project site]: http://www.jsdom.org | ||
[mjsunit.runner]: http://github.com/tmpvar/mjsunit.runner | ||
[testlog]: http://github.com/tmpvar/jsdom/blob/master/test/testlog.txt | ||
[plan]: http://github.com/tmpvar/jsdom/blob/master/PLAN.md | ||
|
||
|
||
# Examples | ||
|
||
## Creating a document-less window | ||
|
||
var jsdom = require("jsdom"), | ||
window = jsdom.createWindow(); | ||
|
||
console.log(window.document); | ||
// output: undefined | ||
|
||
## Creating a document | ||
var jsdom = require("jsdom"), | ||
doc = new (jsdom.dom.level1.core.Document)(); | ||
console.log(doc.nodeName); | ||
// outputs: #document | ||
|
||
## Creating a browser-like BOM/DOM/Window | ||
|
||
var jsdom = require("./lib/jsdom").jsdom, | ||
window = jsdom("<html><head></head><body>hello world</body></html>").createWindow(); | ||
|
||
console.log(window.document.innerHTML); | ||
// output: '<html><head></head><body>hello world</body></html>' | ||
|
||
console.log(window.innerWidth) | ||
// output: 1024 | ||
|
||
console.log(typeof window.document.getElementsByClassName); | ||
// outputs: function | ||
|
||
## Load arbitrary scripts | ||
var jsdom = require("jsdom").jsdom, | ||
window = jsdom().createWindow(), | ||
script = window.document.createElement("script"); | ||
|
||
script.src = 'http://code.jquery.com/jquery-1.4.2.js'; | ||
|
||
script.onload = function() { | ||
if (this.readyState === 'complete') { | ||
console.log(window.jQuery.fn.jquery); | ||
// outputs: 1.4.2 | ||
} | ||
}; | ||
|
||
## jQueryify | ||
|
||
var jsdom = require("jsdom"), | ||
window = jsdom.jsdom().createWindow(); | ||
|
||
jsdom.jQueryify(window, "http://code.jquery.com/jquery-1.4.2.min.js" , function() { | ||
window.jQuery('body').append(<div class='testing'>Hello World, It works</div>"); | ||
console.log(window.jQuery(".testing").text()); | ||
}); | ||
## The idea: | ||
the idea is to create somthing similar to hkvstore.com's Phpmaker or Aspmaker or Microsoft Dot.NET 3 sp1 DynamicData application. | ||
|
||
an application runtime generation framework. to generate nodejs+mongodb(+nginx) applications. | ||
in those modes of development you configure the data models, and all else is kind of, | ||
generated or code reused, | ||
to allow to create data managment web application quickly and easyly with very little effort. | ||
|
||
## links: | ||
|
||
http://www.asp.net/dynamicdata | ||
|
||
http://www.hkvstore.com/phpmaker/ | ||
|
||
|
||
The first idea about application structure was: | ||
the application is a single aplication but i can be defined in several moduls. | ||
|
||
now i find it hard to implement everything i shared objects. | ||
|
||
## Logical app object model: | ||
'- application | ||
|- shared_models | ||
|- shared_templates of the application | ||
|- shared_pages of pages | ||
'- shared_url_routes | ||
|
||
###the same in words: | ||
|
||
the application object is shared and accesible between all moduls in the application. | ||
a module contains a part of application definition functions and objects. | ||
application definition can be spread between many moduls for convinience | ||
|
||
a module extends the application object or the application's shared objects boted in the tree chart above. | ||
|
||
it is posible to define a model in a module, then call kind of a macro function | ||
that adds all (edit,add,delete,list) functions and templates and urls to the application | ||
as defined by that model. | ||
also you can define all those by your self so you can make custom pages. | ||
|
||
## templates system: | ||
what is good about phpmaker is that it allows you easyly define an application, | ||
what is good in dot net DynamicData is that the templates are like components. | ||
in templates you have: fields/textfiled.html, paritials/grid.html, pages/list.html | ||
at 1st all files composed together. later it is used as template. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.