Permalink
Browse files

Land: move away from deprecated 'sys' module

  • Loading branch information...
1 parent 350575f commit 1efb7c8cb11fab563f25d3077602eb2097ec778e @tmpvar committed Nov 20, 2011
View
@@ -1,6 +1,3 @@
-
-var sys = require('sys');
-
var dom = require('../../lib/jsdom/level2/html').dom.level2.html;
var browser = require('../../lib/jsdom/browser/index').windowAugmentation(dom);
@@ -24,14 +21,14 @@ el2.id = 'foo2bar';
el2.innerHTML = '<em class="odd">This is a test</em> This <strong>is another</strong> test ';
browser.document.body.appendChild(el2);
-sys.puts('getElementByid(foo2bar): ' + browser.document.getElementById('foo2bar'));
-sys.puts('getElementByid(foo): ' + browser.document.getElementById('foo'));
-sys.puts('getElementByTagName(em): ' + browser.document.getElementsByTagName('em'));
-sys.puts('getElementByClassName(odd): ' + browser.document.getElementsByClassName('odd'));
+console.log('getElementByid(foo2bar): ' + browser.document.getElementById('foo2bar'));
+console.log('getElementByid(foo): ' + browser.document.getElementById('foo'));
+console.log('getElementByTagName(em): ' + browser.document.getElementsByTagName('em'));
+console.log('getElementByClassName(odd): ' + browser.document.getElementsByClassName('odd'));
-sys.puts('');
-sys.puts('document.body.outerHTML: ');
-sys.puts(document.body.outerHTML);
+console.log('');
+console.log('document.body.outerHTML: ');
+console.log(document.body.outerHTML);
-sys.puts('document.outerHTML: ');
-sys.puts(document.outerHTML);
+console.log('document.outerHTML: ');
+console.log(document.outerHTML);
View
@@ -1,5 +1,4 @@
-var sys = require('sys'),
- dom = require("../../lib/jsdom/level1/core").dom.level1.core;
+var dom = require("../../lib/jsdom/level1/core").dom.level1.core;
// git clone git://github.com/robrighter/node-xml.git into ~/.node_libraries
var xml = require("node-xml/lib/node-xml");
@@ -9,36 +8,36 @@ var currentElement = doc;
var totalElements = 0;
var parser = new xml.SaxParser(function(cb) {
cb.onStartDocument(function() {
-
+
});
cb.onEndDocument(function() {
- sys.puts((doc.getElementsByTagName("*").length === totalElements) ? "success" : "fail");
+ console.log((doc.getElementsByTagName("*").length === totalElements) ? "success" : "fail");
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
totalElements++;
var element = doc.createElement(elem);
currentElement.appendChild(element);
currentElement = element;
- sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
+ console.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
});
cb.onEndElementNS(function(elem, prefix, uri) {
currentElement = currentElement.parentNode;
- sys.puts("<= End: " + elem + " uri="+uri + "\n");
+ console.log("<= End: " + elem + " uri="+uri + "\n");
});
cb.onCharacters(function(chars) {
-
+
});
cb.onCdata(function(cdata) {
- sys.puts('<CDATA>'+cdata+"</CDATA>");
+ console.log('<CDATA>'+cdata+"</CDATA>");
});
cb.onComment(function(msg) {
- sys.puts('<COMMENT>'+msg+"</COMMENT>");
+ console.log('<COMMENT>'+msg+"</COMMENT>");
});
cb.onWarning(function(msg) {
- sys.puts('<WARNING>'+msg+"</WARNING>");
+ console.log('<WARNING>'+msg+"</WARNING>");
});
cb.onError(function(msg) {
- sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
+ console.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
});
});
Oops, something went wrong.

1 comment on commit 1efb7c8

quangv commented on 1efb7c8 Nov 21, 2011

+1 very nice :)

Please sign in to comment.