@antv/g-svg 1.1.4 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -38,16 +38,18 @@ var SVGContextService = /*#__PURE__*/function () {
38
38
  var _proto = SVGContextService.prototype;
39
39
 
40
40
  _proto.init = function init() {
41
- var container = this.canvasConfig.container; // create container
41
+ var _this$canvasConfig = this.canvasConfig,
42
+ container = _this$canvasConfig.container,
43
+ doc = _this$canvasConfig.document; // create container
42
44
 
43
- this.$container = isString(container) ? document.getElementById(container) : container;
45
+ this.$container = isString(container) ? (doc || document).getElementById(container) : container;
44
46
 
45
47
  if (this.$container) {
46
48
  if (!this.$container.style.position) {
47
49
  this.$container.style.position = 'relative';
48
50
  }
49
51
 
50
- var $namespace = createSVGElement('svg');
52
+ var $namespace = createSVGElement('svg', doc);
51
53
  $namespace.setAttribute('width', "" + this.canvasConfig.width);
52
54
  $namespace.setAttribute('height', "" + this.canvasConfig.height);
53
55
  this.$container.appendChild($namespace);
package/dist/index.js CHANGED
@@ -60,16 +60,18 @@ var SVGContextService = /*#__PURE__*/function () {
60
60
  var _proto = SVGContextService.prototype;
61
61
 
62
62
  _proto.init = function init() {
63
- var container = this.canvasConfig.container; // create container
63
+ var _this$canvasConfig = this.canvasConfig,
64
+ container = _this$canvasConfig.container,
65
+ doc = _this$canvasConfig.document; // create container
64
66
 
65
- this.$container = g.isString(container) ? document.getElementById(container) : container;
67
+ this.$container = g.isString(container) ? (doc || document).getElementById(container) : container;
66
68
 
67
69
  if (this.$container) {
68
70
  if (!this.$container.style.position) {
69
71
  this.$container.style.position = 'relative';
70
72
  }
71
73
 
72
- var $namespace = SVGRenderer.createSVGElement('svg');
74
+ var $namespace = SVGRenderer.createSVGElement('svg', doc);
73
75
  $namespace.setAttribute('width', "" + this.canvasConfig.width);
74
76
  $namespace.setAttribute('height', "" + this.canvasConfig.height);
75
77
  this.$container.appendChild($namespace);