# HG changeset patch # User Emmanuel Gil Peyrot # Date 1320252508 25200 # Node ID 461a24a5a788247ac361de44fe281852ad4a26f8 # Parent 7ab6b48122af7d6de2a0cdd91d6efeb92d797b34 Silent errors when testing if we are server- or client-side. diff --git a/atom.js b/atom.js --- 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) diff --git a/configuration.js b/configuration.js --- 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'; diff --git a/jid.js b/jid.js --- 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; diff --git a/ns.js b/ns.js --- a/ns.js +++ b/ns.js @@ -12,5 +12,5 @@ var ns = { var parsers = {}; -if (module) +if (typeof module !== 'undefined') module.exports = ns;