forked from davglass/nodejs-yui3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
general-dom.js
executable file
·68 lines (51 loc) · 2.08 KB
/
general-dom.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env node
var sys = require('sys'),
YUI = require("yui3").YUI;
YUI({
filter: 'debug',
_logExclude: {
'attribute': true,
'base': true,
'get': true,
'loader': true,
'yui': true,
'widget': true,
'event': true
},
debug: true
}).use('node', function(Y) {
Y.log('JSDom testing..');
//sys.puts('Inside1: ' + sys.inspect(process.memoryUsage()));
var document = Y.Browser.document;
var i = Y.Node.create('<i>Test This</i>');
i.addClass('foo');
Y.one('body').append(i);
var div = document.createElement('div');
div.id = 'foo';
div.innerHTML = '<em id="foo">Test</em> this <strong id="bax">awesome <u id="foo:bar">shit..</u></strong>';
document.body.appendChild(div);
var foo = Y.one('#foo');
foo.addClass('bar');
Y.log(document.getElementById('foo').outerHTML, 'info', 'GEBI');
Y.log(document.getElementById('bax').outerHTML, 'info', 'GEBI');
//sys.puts('Inside2: ' + sys.inspect(process.memoryUsage()));
Y.log(Y.Node.getDOMNode(Y.one('strong')), 'info');
Y.log(Y.all('em, #bax').toString(), 'info');
Y.log(Y.Node.getDOMNode(Y.one('strong')), 'info');
Y.log(Y.all('em, u').toString(), 'info');
Y.log(Y.all('#foo, em, u, #bax'), 'info');
//sys.puts('Inside3: ' + sys.inspect(process.memoryUsage()));
Y.log(i.toString(), 'info', 'node-instance');
Y.log(Y.Node.getDOMNode(i).outerHTML, 'info', 'HTML');
Y.log(foo.toString(), 'info', 'node-instance');
Y.log(foo.get('className'), 'info', 'classname');
Y.log(Y.Node.getDOMNode(foo).outerHTML, 'info', 'HTML');
Y.log(Y.one('body'), 'info', 'BODY');
Y.log(Y.all('body, div', null, true), 'info', 'BODY');
Y.log(document.body.outerHTML, 'info', 'HTML');
Y.log(document.getElementById('foo\:bar'), 'info', 'HTML');
Y.log(document.getElementById('foo:bar'), 'info', 'HTML');
Y.log(document.parentNode, 'info', 'document.parentNode');
Y.log(document.outerHTML, 'info', 'document.outerHTML');
//Y.log(document.getElementById('bax').outerHTML, 'HTML');
});