cotomy 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cotomy.js +4 -2
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/view.js +4 -2
- package/dist/esm/view.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/cotomy.js
CHANGED
|
@@ -893,7 +893,7 @@ class CotomyElement {
|
|
|
893
893
|
return new ctor(element);
|
|
894
894
|
}
|
|
895
895
|
static last(selector, type) {
|
|
896
|
-
const elements =
|
|
896
|
+
const elements = CotomyElement.find(selector, type);
|
|
897
897
|
return elements.pop();
|
|
898
898
|
}
|
|
899
899
|
static find(selector, type) {
|
|
@@ -905,7 +905,9 @@ class CotomyElement {
|
|
|
905
905
|
return document.querySelector(selector) !== null;
|
|
906
906
|
}
|
|
907
907
|
static byId(id, type) {
|
|
908
|
-
|
|
908
|
+
const element = document.getElementById(id);
|
|
909
|
+
const ctor = (type ?? CotomyElement);
|
|
910
|
+
return !element ? undefined : new ctor(element);
|
|
909
911
|
}
|
|
910
912
|
static containsById(id) {
|
|
911
913
|
return document.getElementById(id) !== null;
|