changeset 8:461a24a5a788

Silent errors when testing if we are server- or client-side.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 02 Nov 2011 09:48:28 -0700
parents 7ab6b48122af
children 42d3f454d4b4
files atom.js configuration.js jid.js ns.js
diffstat 4 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/atom.js
+++ b/atom.js
@@ -1,5 +1,18 @@
 'use strict';
 
+if (!document)
+	var document = {};
+
+if (!document.createElementNS)
+	document.createElementNS = function(ns, name) {
+		return new Element(name, {xmlns: ns});
+	};
+
+if (!document.createTextNode)
+	document.createTextNode = function(text) {
+		return text;
+	};
+
 parsers[ns.atom] = function(id, xml) {
 	var toDate = function(atom) {
 		if (!atom)
--- a/configuration.js
+++ b/configuration.js
@@ -18,7 +18,7 @@
 
 'use strict';
 
-var config = exports || {};
+var config = (typeof exports !== 'undefined')? exports: {};
 
 // The JID and password of the account used.
 config.jid = 'blog@linkmauve.fr';
--- a/jid.js
+++ b/jid.js
@@ -101,5 +101,5 @@ var JID = function(jid) {
 		this.full = jid;
 };
 
-if (module)
+if (typeof module !== 'undefined')
 	module.exports = JID;
--- a/ns.js
+++ b/ns.js
@@ -12,5 +12,5 @@ var ns = {
 
 var parsers = {};
 
-if (module)
+if (typeof module !== 'undefined')
 	module.exports = ns;