diff --git a/dist/sapa.esm.js b/dist/sapa.esm.js
index 59872b1..3f8d7f9 100644
--- a/dist/sapa.esm.js
+++ b/dist/sapa.esm.js
@@ -747,9 +747,20 @@ class Dom {
return null;
}
- static createFragment (htmlString) {
- var div = Dom.create('div');
- return Dom.create(div.html(htmlString).createChildrenFragment())
+ static createBySVG (svgString) {
+
+ var list = Dom.createByHTML(``).children();
+
+ if (list.length) {
+ return Dom.create(list[0].el);
+ }
+
+ return null;
+ }
+
+ static createFragment (domString, containerTag = 'div') {
+ var div = Dom.create(containerTag);
+ return Dom.create(div.html(domString).createChildrenFragment())
}
static getScrollTop() {
@@ -980,6 +991,14 @@ class Dom {
return $dom;
}
+ prependSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.prepend($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
appendHTML(html) {
var $dom = Dom.create("div").html(html);
@@ -988,6 +1007,14 @@ class Dom {
return $dom;
}
+ appendSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.append($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
/**
* create document fragment with children dom
*/
diff --git a/dist/sapa.js b/dist/sapa.js
index f6a7f0e..c95693f 100644
--- a/dist/sapa.js
+++ b/dist/sapa.js
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sapa = {}));
+ (global = global || self, factory(global.sapa = {}));
}(this, (function (exports) { 'use strict';
function debounce (callback, delay = 0) {
@@ -753,9 +753,20 @@
return null;
}
- static createFragment (htmlString) {
- var div = Dom.create('div');
- return Dom.create(div.html(htmlString).createChildrenFragment())
+ static createBySVG (svgString) {
+
+ var list = Dom.createByHTML(``).children();
+
+ if (list.length) {
+ return Dom.create(list[0].el);
+ }
+
+ return null;
+ }
+
+ static createFragment (domString, containerTag = 'div') {
+ var div = Dom.create(containerTag);
+ return Dom.create(div.html(domString).createChildrenFragment())
}
static getScrollTop() {
@@ -986,6 +997,14 @@
return $dom;
}
+ prependSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.prepend($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
appendHTML(html) {
var $dom = Dom.create("div").html(html);
@@ -994,6 +1013,14 @@
return $dom;
}
+ appendSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.append($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
/**
* create document fragment with children dom
*/
diff --git a/package.json b/package.json
index dc7511e..563054b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@easylogic/sapa",
- "version": "0.1.0",
+ "version": "0.1.1",
"description": "Simple JS Application Library",
"main": "dist/sapa.js",
"module": "dist/sapa.esm.js",
diff --git a/src/util/Dom.js b/src/util/Dom.js
index 8a22dc0..3a7772b 100644
--- a/src/util/Dom.js
+++ b/src/util/Dom.js
@@ -43,9 +43,20 @@ export class Dom {
return null;
}
- static createFragment (htmlString) {
- var div = Dom.create('div')
- return Dom.create(div.html(htmlString).createChildrenFragment())
+ static createBySVG (svgString) {
+
+ var list = Dom.createByHTML(``).children()
+
+ if (list.length) {
+ return Dom.create(list[0].el);
+ }
+
+ return null;
+ }
+
+ static createFragment (domString, containerTag = 'div') {
+ var div = Dom.create(containerTag)
+ return Dom.create(div.html(domString).createChildrenFragment())
}
static getScrollTop() {
@@ -276,6 +287,14 @@ export class Dom {
return $dom;
}
+ prependSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.prepend($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
appendHTML(html) {
var $dom = Dom.create("div").html(html);
@@ -284,6 +303,14 @@ export class Dom {
return $dom;
}
+ appendSVG(html) {
+ var $dom = Dom.create("div").html(``);
+
+ this.append($dom.$('svg').createChildrenFragment());
+
+ return $dom;
+ }
+
/**
* create document fragment with children dom
*/