diff options
author | Hashem Nasarat <hashem@riseup.net> | 2016-01-22 15:29:55 -0500 |
---|---|---|
committer | Hashem Nasarat <hashem@riseup.net> | 2016-02-15 14:28:17 -0500 |
commit | 3456f3d7c107cbd524be94ce7971171d21261cb2 (patch) | |
tree | e0ba99f40a49e650dbfddc9139a424e228cb73b1 /src/xmldom | |
parent | 9825f2f842748dcbde3effcac6221b50a938770d (diff) | |
download | gnome-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.js | 5 | ||||
-rw-r--r-- | src/xmldom/domparser.js (renamed from src/xmldom/dom-parser.js) | 18 | ||||
-rw-r--r-- | src/xmldom/sax.js | 5 |
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;
-}
-
|