@thi.ng/rdom
Advanced tools
Comparing version 1.1.22 to 1.2.0
# Change Log | ||
- **Last updated**: 2024-04-08T14:59:30Z | ||
- **Last updated**: 2024-04-11T12:32:44Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,10 @@ | ||
## [1.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.2.0) (2024-04-11) | ||
#### 🚀 Features | ||
- update setAttrib() property vs. attrib handling ([52cfe72](https://github.com/thi-ng/umbrella/commit/52cfe72)) | ||
- add/build cache of property setters | ||
- update setAttrib() to prioritize setters and only fallback to attributes | ||
## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.1.0) (2024-02-10) | ||
@@ -14,0 +22,0 @@ |
35
dom.js
@@ -103,6 +103,13 @@ import { deref, isDeref } from "@thi.ng/api/deref"; | ||
}; | ||
const __setterCache = {}; | ||
const getproto = Object.getPrototypeOf; | ||
const getdesc = Object.getOwnPropertyDescriptor; | ||
const __desc = (proto, prop) => proto ? getdesc(proto, prop) ?? __desc(getproto(proto), prop) : void 0; | ||
const __setter = (el, prop) => { | ||
const key = `${el.namespaceURI}/${el.tagName}#${prop}`; | ||
return __setterCache[key] ?? (__setterCache[key] = __desc(getproto(el), prop)?.set ?? false); | ||
}; | ||
const setAttrib = (el, id, val, attribs) => { | ||
implementsFunction(val, "deref") && (val = val.deref()); | ||
const isListener = id.startsWith("on"); | ||
if (isListener) { | ||
if (id.startsWith("on")) { | ||
if (isString(val)) { | ||
@@ -134,23 +141,7 @@ el.setAttribute(id, val); | ||
break; | ||
case "accessKey": | ||
case "autocapitalize": | ||
case "checked": | ||
case "contentEditable": | ||
case "dir": | ||
case "draggable": | ||
case "hidden": | ||
case "id": | ||
case "indeterminate": | ||
case "lang": | ||
case "scrollLeft": | ||
case "scrollTop": | ||
case "selectionEnd": | ||
case "selectionStart": | ||
case "slot": | ||
case "spellcheck": | ||
case "tabIndex": | ||
case "title": | ||
el[id] = val; | ||
break; | ||
default: { | ||
const setter = __setter(el, id); | ||
if (setter && val != null) { | ||
return setter.call(el, val); | ||
} | ||
const idx = id.indexOf(":"); | ||
@@ -157,0 +148,0 @@ if (idx < 0) { |
{ | ||
"name": "@thi.ng/rdom", | ||
"version": "1.1.22", | ||
"version": "1.2.0", | ||
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible", | ||
@@ -40,10 +40,10 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.10.0", | ||
"@thi.ng/checks": "^3.6.0", | ||
"@thi.ng/errors": "^2.5.3", | ||
"@thi.ng/hiccup": "^5.1.27", | ||
"@thi.ng/paths": "^5.1.77", | ||
"@thi.ng/prefixes": "^2.3.15", | ||
"@thi.ng/rstream": "^8.3.20", | ||
"@thi.ng/strings": "^3.7.29" | ||
"@thi.ng/api": "^8.10.1", | ||
"@thi.ng/checks": "^3.6.1", | ||
"@thi.ng/errors": "^2.5.4", | ||
"@thi.ng/hiccup": "^5.1.28", | ||
"@thi.ng/paths": "^5.1.78", | ||
"@thi.ng/prefixes": "^2.3.16", | ||
"@thi.ng/rstream": "^8.4.0", | ||
"@thi.ng/strings": "^3.7.30" | ||
}, | ||
@@ -147,3 +147,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "85ac4bd4d6d89f8e3689e2863d5bea0cecdb371c\n" | ||
"gitHead": "18a0c063a7b33d790e5bc2486c106f45f663ac28\n" | ||
} |
@@ -10,3 +10,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
> [!NOTE] | ||
> This is one of 191 standalone projects, maintained as part | ||
> This is one of 192 standalone projects, maintained as part | ||
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo | ||
@@ -283,3 +283,3 @@ > and anti-framework. | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.02 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.04 KB | ||
@@ -286,0 +286,0 @@ ## Dependencies |
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
125069
2059
Updated@thi.ng/api@^8.10.1
Updated@thi.ng/checks@^3.6.1
Updated@thi.ng/errors@^2.5.4
Updated@thi.ng/hiccup@^5.1.28
Updated@thi.ng/paths@^5.1.78
Updated@thi.ng/prefixes@^2.3.16
Updated@thi.ng/rstream@^8.4.0
Updated@thi.ng/strings@^3.7.30