Commit 88dc21cc authored by Klaus Wölfel's avatar Klaus Wölfel

Fix node.js test: move document===undefined check to cloudooo storage

parent 96b399eb
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
* See https://www.nexedi.com/licensing for rationale and options. * See https://www.nexedi.com/licensing for rationale and options.
*/ */
/*global window, RSVP, Blob, XMLHttpRequest, QueryFactory, Query, atob, /*global window, RSVP, Blob, XMLHttpRequest, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array, navigator */ FileReader, ArrayBuffer, Uint8Array */
(function (window, RSVP, Blob, QueryFactory, Query, atob, (function (window, RSVP, Blob, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array, navigator) { FileReader, ArrayBuffer, Uint8Array) {
"use strict"; "use strict";
/* Safari does not define DOMError */ /* Safari does not define DOMError */
...@@ -28,17 +28,6 @@ ...@@ -28,17 +28,6 @@
window.DOMError = {}; window.DOMError = {};
} }
/* Document is not defined in ServiceWorkser */
if (window.document === undefined) {
window.document = {
createElementNS: function () {
throw new Error(
'document.createElementNS is not supported by ' + navigator.userAgent
);
}
};
}
var util = {}, var util = {},
jIO; jIO;
...@@ -566,4 +555,4 @@ ...@@ -566,4 +555,4 @@
window.jIO = jIO; window.jIO = jIO;
}(window, RSVP, Blob, QueryFactory, Query, atob, }(window, RSVP, Blob, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array, navigator)); FileReader, ArrayBuffer, Uint8Array));
...@@ -19,10 +19,21 @@ ...@@ -19,10 +19,21 @@
*/ */
/*jslint nomen: true*/ /*jslint nomen: true*/
/*global document, jIO, RSVP, DOMParser, XMLSerializer*/ /*global window, jIO, RSVP, DOMParser, XMLSerializer, navigator*/
(function (document, jIO, RSVP, DOMParser, XMLSerializer) { (function (window, jIO, RSVP, DOMParser, XMLSerializer, navigator) {
"use strict"; "use strict";
/* Document is not defined in ServiceWorker */
if (window.document === undefined) {
window.document = {
createElementNS: function () {
throw new Error(
'document.createElementNS is not supported by ' + navigator.userAgent
);
}
};
}
var parser = new DOMParser(), var parser = new DOMParser(),
serializer = new XMLSerializer(); serializer = new XMLSerializer();
...@@ -50,13 +61,13 @@ ...@@ -50,13 +61,13 @@
if (conversion_kw) { if (conversion_kw) {
for (key in conversion_kw) { for (key in conversion_kw) {
if (conversion_kw.hasOwnProperty(key)) { if (conversion_kw.hasOwnProperty(key)) {
elt = document.createElementNS(null, conversion_kw[key][1]); elt = window.document.createElementNS(null, conversion_kw[key][1]);
elt.textContent = conversion_kw[key][0]; elt.textContent = conversion_kw[key][0];
value = document.createElementNS(null, "value"); value = window.document.createElementNS(null, "value");
value.appendChild(elt); value.appendChild(elt);
name = document.createElementNS(null, "name"); name = window.document.createElementNS(null, "name");
name.textContent = key; name.textContent = key;
member = document.createElementNS(null, "member"); member = window.document.createElementNS(null, "member");
member.appendChild(name); member.appendChild(name);
member.appendChild(value); member.appendChild(value);
struct[0].appendChild(member); struct[0].appendChild(member);
...@@ -165,4 +176,4 @@ ...@@ -165,4 +176,4 @@
jIO.addStorage('cloudooo', CloudoooStorage); jIO.addStorage('cloudooo', CloudoooStorage);
}(document, jIO, RSVP, DOMParser, XMLSerializer)); }(window, jIO, RSVP, DOMParser, XMLSerializer, navigator));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment