@nextgis/dom
Advanced tools
Comparing version 1.11.10 to 1.12.0
@@ -1,4 +0,4 @@ | ||
/** Bundle of @nextgis/dom; version: 1.11.10; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.12.0; author: NextGIS */ | ||
function create(tagName, className, container) { | ||
const el = window.document.createElement(tagName); | ||
var el = window.document.createElement(tagName); | ||
if (className !== undefined && className !== null) { | ||
@@ -24,3 +24,3 @@ el.className = className; | ||
if (typeof el === 'string') { | ||
let el_ = document.getElementById(el); | ||
var el_ = document.getElementById(el); | ||
if (!el_) { | ||
@@ -30,3 +30,3 @@ try { | ||
} | ||
catch { | ||
catch (_a) { | ||
// ignore | ||
@@ -40,7 +40,7 @@ } | ||
function remove(element) { | ||
const el = getElement(element); | ||
var el = getElement(element); | ||
if (el) { | ||
const parent = el.parentElement; | ||
if (parent) { | ||
parent.removeChild(el); | ||
var parent_1 = el.parentElement; | ||
if (parent_1) { | ||
parent_1.removeChild(el); | ||
} | ||
@@ -50,5 +50,6 @@ } | ||
function loadScript(src, options = {}) { | ||
return new Promise((resolve, reject) => { | ||
const s = document.createElement('script'); | ||
function loadScript(src, options) { | ||
if (options === void 0) { options = {}; } | ||
return new Promise(function (resolve, reject) { | ||
var s = document.createElement('script'); | ||
s.src = src; | ||
@@ -74,4 +75,4 @@ s.onload = resolve; | ||
if (options.data) { | ||
for (const k in options.data) { | ||
const dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
for (var k in options.data) { | ||
var dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
s.setAttribute('data-' + dataKey, String(options.data[k])); | ||
@@ -78,0 +79,0 @@ } |
@@ -1,2 +0,2 @@ | ||
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}; | ||
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}; | ||
//# sourceMappingURL=dom.esm-browser.prod.js.map |
@@ -1,4 +0,4 @@ | ||
/** Bundle of @nextgis/dom; version: 1.11.10; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.12.0; author: NextGIS */ | ||
function create(tagName, className, container) { | ||
const el = window.document.createElement(tagName); | ||
var el = window.document.createElement(tagName); | ||
if (className !== undefined && className !== null) { | ||
@@ -24,3 +24,3 @@ el.className = className; | ||
if (typeof el === 'string') { | ||
let el_ = document.getElementById(el); | ||
var el_ = document.getElementById(el); | ||
if (!el_) { | ||
@@ -30,3 +30,3 @@ try { | ||
} | ||
catch { | ||
catch (_a) { | ||
// ignore | ||
@@ -40,7 +40,7 @@ } | ||
function remove(element) { | ||
const el = getElement(element); | ||
var el = getElement(element); | ||
if (el) { | ||
const parent = el.parentElement; | ||
if (parent) { | ||
parent.removeChild(el); | ||
var parent_1 = el.parentElement; | ||
if (parent_1) { | ||
parent_1.removeChild(el); | ||
} | ||
@@ -50,5 +50,6 @@ } | ||
function loadScript(src, options = {}) { | ||
return new Promise((resolve, reject) => { | ||
const s = document.createElement('script'); | ||
function loadScript(src, options) { | ||
if (options === void 0) { options = {}; } | ||
return new Promise(function (resolve, reject) { | ||
var s = document.createElement('script'); | ||
s.src = src; | ||
@@ -74,4 +75,4 @@ s.onload = resolve; | ||
if (options.data) { | ||
for (const k in options.data) { | ||
const dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
for (var k in options.data) { | ||
var dataKey = k.replace(/^data-/, '').replace(/_/g, '-'); | ||
s.setAttribute('data-' + dataKey, String(options.data[k])); | ||
@@ -78,0 +79,0 @@ } |
@@ -1,2 +0,2 @@ | ||
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}; | ||
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}; | ||
//# sourceMappingURL=dom.esm-bundler.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/dom; version: 1.11.10; author: NextGIS */ | ||
/** Bundle of @nextgis/dom; version: 1.12.0; author: NextGIS */ | ||
var Dom = (function (exports) { | ||
@@ -3,0 +3,0 @@ 'use strict'; |
{ | ||
"name": "@nextgis/dom", | ||
"version": "1.11.10", | ||
"version": "1.12.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.11.10" | ||
"@nextgis/build-tools": "^1.12.0" | ||
}, | ||
@@ -47,3 +47,3 @@ "buildOptions": { | ||
}, | ||
"gitHead": "51bd939cf50df9657bbe5ed37327d641457eb417" | ||
"gitHead": "cc0e45b49ec7cfcbd3c5ce00a5e0d6682cf8f21c" | ||
} |
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
38944
283