@nextgis/dom
Advanced tools
Comparing version 1.16.8 to 1.17.0
@@ -1,4 +0,4 @@ | ||
/** Bundle of @nextgis/dom; version: 1.16.8; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.17.0; author: NextGIS */ | ||
function create(tagName, className, container) { | ||
var el = window.document.createElement(tagName); | ||
const el = window.document.createElement(tagName); | ||
if (className !== undefined && className !== null) { | ||
@@ -24,3 +24,3 @@ el.className = className; | ||
if (typeof el === 'string') { | ||
var el_ = document.getElementById(el); | ||
let el_ = document.getElementById(el); | ||
if (!el_) { | ||
@@ -30,3 +30,3 @@ try { | ||
} | ||
catch (_a) { | ||
catch { | ||
// ignore | ||
@@ -40,7 +40,7 @@ } | ||
function remove(element) { | ||
var el = getElement(element); | ||
const el = getElement(element); | ||
if (el) { | ||
var parent_1 = el.parentElement; | ||
if (parent_1) { | ||
parent_1.removeChild(el); | ||
const parent = el.parentElement; | ||
if (parent) { | ||
parent.removeChild(el); | ||
} | ||
@@ -50,6 +50,5 @@ } | ||
function loadScript(src, options) { | ||
if (options === void 0) { options = {}; } | ||
return new Promise(function (resolve, reject) { | ||
var s = document.createElement('script'); | ||
function loadScript(src, options = {}) { | ||
return new Promise((resolve, reject) => { | ||
const s = document.createElement('script'); | ||
s.src = src; | ||
@@ -75,4 +74,4 @@ s.onload = resolve; | ||
if (options.data) { | ||
for (var k in options.data) { | ||
var dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
for (const k in options.data) { | ||
const dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
s.setAttribute('data-' + dataKey, String(options.data[k])); | ||
@@ -79,0 +78,0 @@ } |
@@ -1,2 +0,2 @@ | ||
function e(e,t,r){var n=window.document.createElement(e);return null!=t&&(n.className=t),r&&r.appendChild(n),n}function t(e){if("string"==typeof e){var t=document.getElementById(e);if(!t)try{t=document.querySelector(e)}catch(r){}return t||void 0}return e}function r(e){var r=t(e);if(r){var n=r.parentElement;n&&n.removeChild(r)}}function n(e,t){return void 0===t&&(t={}),new Promise((function(r,n){var a=document.createElement("script");if(a.src=e,a.onload=r,a.onerror=n,a.type="text/javascript",t.crossOrigin&&a.setAttribute("crossorigin",t.crossOrigin),t.async&&(a.async=!0),t.defer&&(a.defer=!0),t.id&&a.setAttribute("id",t.id),t.data)for(var i in t.data){var o=i.replace(/^data-/,"").replace(/_/g,"-");a.setAttribute("data-"+o,String(t.data[i]))}document.head.appendChild(a)}))}export{e as create,t as getElement,n as loadScript,r as remove}; | ||
function t(t,e,n){const r=window.document.createElement(t);return null!=e&&(r.className=e),n&&n.appendChild(r),r}function e(t){if("string"==typeof t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{}return e||void 0}return t}function n(t){const n=e(t);if(n){const t=n.parentElement;t&&t.removeChild(n)}}function r(t,e={}){return new Promise(((n,r)=>{const c=document.createElement("script");if(c.src=t,c.onload=n,c.onerror=r,c.type="text/javascript",e.crossOrigin&&c.setAttribute("crossorigin",e.crossOrigin),e.async&&(c.async=!0),e.defer&&(c.defer=!0),e.id&&c.setAttribute("id",e.id),e.data)for(const t in e.data){const n=t.replace(/^data-/,"").replace(/_/g,"-");c.setAttribute("data-"+n,String(e.data[t]))}document.head.appendChild(c)}))}export{t as create,e as getElement,r as loadScript,n as remove}; | ||
//# sourceMappingURL=dom.esm-browser.prod.js.map |
@@ -1,4 +0,4 @@ | ||
/** Bundle of @nextgis/dom; version: 1.16.8; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.17.0; author: NextGIS */ | ||
function create(tagName, className, container) { | ||
var el = window.document.createElement(tagName); | ||
const el = window.document.createElement(tagName); | ||
if (className !== undefined && className !== null) { | ||
@@ -24,3 +24,3 @@ el.className = className; | ||
if (typeof el === 'string') { | ||
var el_ = document.getElementById(el); | ||
let el_ = document.getElementById(el); | ||
if (!el_) { | ||
@@ -30,3 +30,3 @@ try { | ||
} | ||
catch (_a) { | ||
catch { | ||
// ignore | ||
@@ -40,7 +40,7 @@ } | ||
function remove(element) { | ||
var el = getElement(element); | ||
const el = getElement(element); | ||
if (el) { | ||
var parent_1 = el.parentElement; | ||
if (parent_1) { | ||
parent_1.removeChild(el); | ||
const parent = el.parentElement; | ||
if (parent) { | ||
parent.removeChild(el); | ||
} | ||
@@ -50,6 +50,5 @@ } | ||
function loadScript(src, options) { | ||
if (options === void 0) { options = {}; } | ||
return new Promise(function (resolve, reject) { | ||
var s = document.createElement('script'); | ||
function loadScript(src, options = {}) { | ||
return new Promise((resolve, reject) => { | ||
const s = document.createElement('script'); | ||
s.src = src; | ||
@@ -75,4 +74,4 @@ s.onload = resolve; | ||
if (options.data) { | ||
for (var k in options.data) { | ||
var dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
for (const k in options.data) { | ||
const dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
s.setAttribute('data-' + dataKey, String(options.data[k])); | ||
@@ -79,0 +78,0 @@ } |
@@ -1,2 +0,2 @@ | ||
function e(e,t,r){var n=window.document.createElement(e);return null!=t&&(n.className=t),r&&r.appendChild(n),n}function t(e){if("string"==typeof e){var t=document.getElementById(e);if(!t)try{t=document.querySelector(e)}catch(r){}return t||void 0}return e}function r(e){var r=t(e);if(r){var n=r.parentElement;n&&n.removeChild(r)}}function n(e,t){return void 0===t&&(t={}),new Promise((function(r,n){var a=document.createElement("script");if(a.src=e,a.onload=r,a.onerror=n,a.type="text/javascript",t.crossOrigin&&a.setAttribute("crossorigin",t.crossOrigin),t.async&&(a.async=!0),t.defer&&(a.defer=!0),t.id&&a.setAttribute("id",t.id),t.data)for(var i in t.data){var o=i.replace(/^data-/,"").replace(/_/g,"-");a.setAttribute("data-"+o,String(t.data[i]))}document.head.appendChild(a)}))}export{e as create,t as getElement,n as loadScript,r as remove}; | ||
function t(t,e,n){const r=window.document.createElement(t);return null!=e&&(r.className=e),n&&n.appendChild(r),r}function e(t){if("string"==typeof t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{}return e||void 0}return t}function n(t){const n=e(t);if(n){const t=n.parentElement;t&&t.removeChild(n)}}function r(t,e={}){return new Promise(((n,r)=>{const c=document.createElement("script");if(c.src=t,c.onload=n,c.onerror=r,c.type="text/javascript",e.crossOrigin&&c.setAttribute("crossorigin",e.crossOrigin),e.async&&(c.async=!0),e.defer&&(c.defer=!0),e.id&&c.setAttribute("id",e.id),e.data)for(const t in e.data){const n=t.replace(/^data-/,"").replace(/_/g,"-");c.setAttribute("data-"+n,String(e.data[t]))}document.head.appendChild(c)}))}export{t as create,e as getElement,r as loadScript,n as remove}; | ||
//# sourceMappingURL=dom.esm-bundler.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/dom; version: 1.16.8; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.17.0; author: NextGIS */ | ||
var Dom = (function (exports) { | ||
@@ -3,0 +3,0 @@ 'use strict'; |
{ | ||
"name": "@nextgis/dom", | ||
"version": "1.16.8", | ||
"version": "1.17.0", | ||
"description": "Collection of libraries for working with the DOM", | ||
@@ -11,3 +11,3 @@ "main": "lib/dom.global.prod.js", | ||
"devDependencies": { | ||
"@nextgis/build-tools": "^1.16.8" | ||
"@nextgis/build-tools": "^1.17.0" | ||
}, | ||
@@ -47,3 +47,3 @@ "buildOptions": { | ||
}, | ||
"gitHead": "e156aa6d884f1987e3f84649284d5f0c70d713a5" | ||
"gitHead": "c3162aae53c381cd6a581a2a67173fb1bf6de87e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39523
281