Commit 88dc21cc by Klaus Wölfel

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

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