@semantic-ui/query
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -26,5 +26,5 @@ { | ||
"dependencies": { | ||
"@semantic-ui/utils": "^0.1.4" | ||
"@semantic-ui/utils": "^0.1.5" | ||
}, | ||
"version": "0.1.4" | ||
"version": "0.1.5" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { isPlainObject, isString, isArray, isDOM, isFunction, findIndex, inArray, isClient, isObject, each } from '@semantic-ui/utils'; | ||
import { isPlainObject, isString, isArray, isDOM, isFunction, findIndex, camelToKebab, inArray, isClient, isObject, each } from '@semantic-ui/utils'; | ||
@@ -49,3 +49,3 @@ /* | ||
// this is html like $('<div/>') | ||
if (selector.slice(0, 1) == '<') { | ||
if (selector.trim().slice(0, 1) == '<') { | ||
const template = document.createElement('template'); | ||
@@ -409,3 +409,3 @@ template.innerHTML = selector.trim(); | ||
// will cause illegal invocation if used from proxy object | ||
const domEL = (this.isGlobal) ? globalThis : el; | ||
const domEL = (el == Query.globalThisProxy) ? globalThis : el; | ||
if (domEL.addEventListener) { | ||
@@ -664,7 +664,7 @@ domEL.addEventListener(eventName, eventListener, { signal, ...eventSettings }); | ||
Object.entries(property).forEach(([prop, val]) => { | ||
elements.forEach((el) => (el.style[prop] = val)); | ||
elements.forEach((el) => el.style.setProperty(camelToKebab(prop), val)); | ||
}); | ||
} | ||
else { | ||
elements.forEach((el) => (el.style[property] = value)); | ||
elements.forEach((el) => el.style.setProperty(camelToKebab(property), value)); | ||
} | ||
@@ -674,3 +674,3 @@ return this; // Return the Query instance for chaining | ||
else { | ||
// Attempt to get a style directly | ||
// Getting a value | ||
if (elements?.length) { | ||
@@ -846,3 +846,21 @@ const styles = elements.map((el) => { | ||
$content.each(el => { | ||
target.insertAdjacentElement(position, el); | ||
if (target.insertAdjacentElement) { | ||
target.insertAdjacentElement(position, el); | ||
} | ||
else { | ||
switch(position) { | ||
case 'beforebegin': | ||
target.parentNode?.insertBefore(el, target); | ||
break; | ||
case 'afterbegin': | ||
target.insertBefore(el, target.firstChild); | ||
break; | ||
case 'beforeend': | ||
target.appendChild(el); | ||
break; | ||
case 'afterend': | ||
target.parentNode?.insertBefore(el, target.nextSibling); | ||
break; | ||
} | ||
} | ||
}); | ||
@@ -981,2 +999,6 @@ } | ||
} | ||
getDataContext() { | ||
const contexts = this.map(el => el.dataContext).filter(Boolean); | ||
return contexts.length > 1 ? contexts : contexts[0]; | ||
} | ||
} |
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
104414
2573
Updated@semantic-ui/utils@^0.1.5