Skip to content

Commit

Permalink
don't expose DOMParser instance on svg utils module object
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed May 16, 2017
1 parent 273a4c3 commit e0050f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/svg_text_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ var Lib = require('../lib');
var xmlnsNamespaces = require('../constants/xmlns_namespaces');
var stringMappings = require('../constants/string_mappings');

var DOM_PARSER;

exports.getDOMParser = function() {
if(exports.domParser) {
return exports.domParser;
if(DOM_PARSER) {
return DOM_PARSER;
} else if(window.DOMParser) {
exports.domParser = new window.DOMParser();
return exports.domParser;
DOM_PARSER = new window.DOMParser();
return DOM_PARSER;
} else {
throw new Error('Cannot initialize DOMParser');
}
Expand Down

0 comments on commit e0050f7

Please sign in to comment.