Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 83 lines (49 sloc) 2.5 kB
a608d33 @davglass Initial Import
authored
1 h1. YUI Bootstrapper for Node.js
2
3 This node.js module attempts to setup and bootstrap a working YUI 3 instance.
4
45e90aa @davglass Updated README with new IO calls
authored
5 This module includes support for remote script loading via Y.Get.script() and remote data fetching via Y.io.
a608d33 @davglass Initial Import
authored
6
04778c4 @davglass Moved around source and examples
authored
7 See "JSDom Support" below for DOM manipulation.
8
a608d33 @davglass Initial Import
authored
9 h2. Setup this repo
10
bac601b @davglass Updated README to remove the submodule step and add the checkout step
authored
11 Clone this project, then do this:
319f2dc @davglass README updates
authored
12 <pre class="console">cd nodejs-yui3/lib
13 git clone git://github.com/yui/yui3.git</pre>
a608d33 @davglass Initial Import
authored
14
04778c4 @davglass Moved around source and examples
authored
15 You should go into that repo every now and then and do a git pull to keep it up to date with the latest YUI source.
16
17
18 h2. Node.js
19
20 These tests and examples are all known to be working with latest stable Node.js: v0.1.33
21
d06e29f @davglass README Updates
authored
22 All of the examples and tests assume you have @node@ in your path and they are all executable.
04778c4 @davglass Moved around source and examples
authored
23
bac601b @davglass Updated README to remove the submodule step and add the checkout step
authored
24
04778c4 @davglass Moved around source and examples
authored
25 h2. JSDom Support
a608d33 @davglass Initial Import
authored
26
d06e29f @davglass README Updates
authored
27 Currently YUI 3 on Node.js supports "JSDom":http://github.com/tmpvar/jsdom
04778c4 @davglass Moved around source and examples
authored
28 It also requires my forked "node-htmlparser":http://github.com/davglass/node-htmlparser
29
30 Getting it up and running:
a608d33 @davglass Initial Import
authored
31
d06e29f @davglass README Updates
authored
32 Node will automatically look in this directory for include files @~/.node_libraries@
33
a608d33 @davglass Initial Import
authored
34 <pre class="console">
319f2dc @davglass README updates
authored
35 mkdir ~/.node_libraries
36 cd ~/.node_libraries
37 wget http://github.com/tmpvar/jsdom/raw/master/lib/level1/core.js -O jsdom.js
38 wget http://github.com/tmpvar/jsdom/raw/master/lib/browser/index.js -O browser.js
39 wget http://github.com/davglass/node-htmlparser/raw/master/node-htmlparser.js
a608d33 @davglass Initial Import
authored
40 </pre>
41
04778c4 @davglass Moved around source and examples
authored
42 Now that the libraries are in the right places you can now use the dom related examples.
43
c4facb3 @davglass Added Y Browser example
authored
44
45 h2. Using the Y.Browser object
46
47 To comply with the "no-globals" CommonJS spec, there is no global document or window in this mode.
48 Just including the nodejs-dom module will create a fake dom for this instance.
49 You can create a document like this:
d06e29f @davglass README Updates
authored
50 "View this Gist":http://gist.github.com/359776
51
52 You can make older DOM code run by setting up a couple of local variables, "like this":http://gist.github.com/359778
c4facb3 @davglass Added Y Browser example
authored
53
54
55 If you are using YUI to serve pages, you should use a Nested Use to create the document when the request comes in.
56
d06e29f @davglass README Updates
authored
57 "Something like this":http://gist.github.com/359781
c4facb3 @davglass Added Y Browser example
authored
58
59
3923dca @davglass README updates
authored
60 I have an example showing this: @examples/y-browser.js@
c4facb3 @davglass Added Y Browser example
authored
61
62
04778c4 @davglass Moved around source and examples
authored
63 h2. Examples
a608d33 @davglass Initial Import
authored
64
65 <pre class="console">
04778c4 @davglass Moved around source and examples
authored
66 cd examples/
67 ./general-dom.js
68 ./io.js
69 ./library.js
3923dca @davglass README updates
authored
70 ./y-brower.js
a608d33 @davglass Initial Import
authored
71 </pre>
72
04778c4 @davglass Moved around source and examples
authored
73 h2. Tests
74
75 When using JSDom, All relevent YUI 3 Dom & Selector tests pass. The ones that are skipped revolve around styles and postioning. Since there is no window or CSS cascade, these seem unimportant at the moment.
76
77 <pre class="console">
78 cd ./tests/
79 ./dom.js
80 ./selector.js
81 </pre>
a608d33 @davglass Initial Import
authored
82
Something went wrong with that request. Please try again.