@blinkk/degu
Advanced tools
Comparing version 0.0.335 to 0.0.336
@@ -15,3 +15,3 @@ export declare class dom { | ||
static event(element: HTMLElement, name: string, data: any): void; | ||
static createElementFromString(htmlString: string): HTMLElement; | ||
static createElementFromString(htmlString: string, fragMethod?: boolean): HTMLElement; | ||
static removeElement(element: HTMLElement): void; | ||
@@ -18,0 +18,0 @@ static runAfterWindowLoad(callback: Function): void; |
@@ -101,6 +101,14 @@ "use strict"; | ||
} | ||
static createElementFromString(htmlString) { | ||
var div = document.createElement('div'); | ||
div.innerHTML = htmlString.trim(); | ||
return div.firstChild; | ||
static createElementFromString(htmlString, fragMethod = false) { | ||
if (fragMethod) { | ||
var holder = document.createElement('div'); | ||
let frag = document.createRange().createContextualFragment(htmlString); | ||
holder.appendChild(frag); | ||
return holder.firstElementChild; | ||
} | ||
else { | ||
var div = document.createElement('div'); | ||
div.innerHTML = htmlString.trim(); | ||
return div.firstChild; | ||
} | ||
} | ||
@@ -107,0 +115,0 @@ static removeElement(element) { |
@@ -24,10 +24,10 @@ "use strict"; | ||
</div> | ||
`); | ||
`, true); | ||
this.mainPanelElement = __1.dom.createElementFromString(` | ||
<div class="${this.nameSpace}__panel"></div> | ||
`); | ||
`, true); | ||
this.mainPanelRefreshButton = __1.dom.createElementFromString(` | ||
<div class="${this.nameSpace}__button">Refresh</div> | ||
`); | ||
this.mainPanelCloseButton = __1.dom.createElementFromString(`<div class="${this.nameSpace}__close">✖️</div>`); | ||
`, true); | ||
this.mainPanelCloseButton = __1.dom.createElementFromString(`<div class="${this.nameSpace}__close">✖️</div>`, true); | ||
this.mainPanelRootElement.append(this.mainPanelCloseButton); | ||
@@ -95,7 +95,7 @@ this.mainPanelRootElement.append(this.mainPanelElement); | ||
<label class="${this.nameSpace}__option"></label> | ||
`); | ||
`, true); | ||
field.element = el; | ||
const title = __1.dom.createElementFromString(` | ||
<div class="${this.nameSpace}__option__title">${field.displayName}</div> | ||
`); | ||
`, true); | ||
const checkbox = __1.dom.createElementFromString(` | ||
@@ -105,3 +105,3 @@ <input type="checkbox" | ||
id="${this.nameSpace}-${field.paramName}"> | ||
`); | ||
`, true); | ||
checkbox.setAttribute('checked', url_params_1.urlParams.isTrue(field.paramName) ? 'true' : 'false'); | ||
@@ -108,0 +108,0 @@ checkbox.checked = url_params_1.urlParams.isTrue(field.paramName); |
{ | ||
"name": "@blinkk/degu", | ||
"version": "0.0.335", | ||
"version": "0.0.336", | ||
"description": "A general utility library for interactive websites, with a focus on performance.", | ||
@@ -5,0 +5,0 @@ "author": "Blinkk <hello@blinkk.com>", |
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
646320
17967