summaryrefslogtreecommitdiff
path: root/src/xmldom
diff options
context:
space:
mode:
authorHashem Nasarat <hashem@riseup.net>2016-01-22 15:29:55 -0500
committerHashem Nasarat <hashem@riseup.net>2016-02-15 14:28:17 -0500
commit3456f3d7c107cbd524be94ce7971171d21261cb2 (patch)
treee0ba99f40a49e650dbfddc9139a424e228cb73b1 /src/xmldom
parent9825f2f842748dcbde3effcac6221b50a938770d (diff)
downloadgnome-maps-3456f3d7c107cbd524be94ce7971171d21261cb2.tar.gz
Layers: Gjs-ify togeojson & xmldom packages
These packages are made with nodejs in mind, so we have to tweak a few things to get them to laod in gjs. https://bugzilla.gnome.org/show_bug.cgi?id=757171
Diffstat (limited to 'src/xmldom')
-rw-r--r--src/xmldom/dom.js5
-rw-r--r--src/xmldom/domparser.js (renamed from src/xmldom/dom-parser.js)18
-rw-r--r--src/xmldom/sax.js5
3 files changed, 7 insertions, 21 deletions
diff --git a/src/xmldom/dom.js b/src/xmldom/dom.js
index 460a1be9..8e640875 100644
--- a/src/xmldom/dom.js
+++ b/src/xmldom/dom.js
@@ -1140,8 +1140,3 @@ try{
}
}catch(e){//ie8
}
-
-if(typeof require == 'function'){
- exports.DOMImplementation = DOMImplementation;
- exports.XMLSerializer = XMLSerializer;
-}
diff --git a/src/xmldom/dom-parser.js b/src/xmldom/domparser.js
index 41a40ad9..09941f6c 100644
--- a/src/xmldom/dom-parser.js
+++ b/src/xmldom/domparser.js
@@ -1,6 +1,8 @@
+const XMLReader = imports.xmldom.sax.XMLReader;
+const DOMImplementation = imports.xmldom.dom.DOMImplementation;
+
function DOMParser(options){
this.options = options ||{locator:{}};
-
}
DOMParser.prototype.parseFromString = function(source,mimeType){
var options = this.options;
@@ -171,13 +173,14 @@ DOMHandler.prototype = {
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
*/
warning:function(error) {
- console.warn('[xmldom warning]\t'+error,_locator(this.locator));
+ log('[xmldom warning]\t'+error);
},
error:function(error) {
- console.error('[xmldom error]\t'+error,_locator(this.locator));
+ log('[xmldom error]\t'+error);
+ throw error;
},
fatalError:function(error) {
- console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
+ log('[xmldom fatalError]\t'+error);
throw error;
}
}
@@ -240,10 +243,3 @@ function appendElement (hander,node) {
hander.currentElement.appendChild(node);
}
}//appendChild and setAttributeNS are preformance key
-
-if(typeof require == 'function'){
- var XMLReader = require('./sax').XMLReader;
- var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
- exports.XMLSerializer = require('./dom').XMLSerializer ;
- exports.DOMParser = DOMParser;
-}
diff --git a/src/xmldom/sax.js b/src/xmldom/sax.js
index 127963f8..c771be3d 100644
--- a/src/xmldom/sax.js
+++ b/src/xmldom/sax.js
@@ -579,8 +579,3 @@ function split(source,start){
if(match[1])return buf;
}
}
-
-if(typeof require == 'function'){
- exports.XMLReader = XMLReader;
-}
-