Skip to content

Commit 3de7de3

Browse files
committed
change uid to ojs-id to avoid clashes with other frameworks
1 parent e956490 commit 3de7de3

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "modular-openscriptjs",
3-
"version": "2.0.15",
3+
"version": "2.0.16",
44
"description": "OpenScriptJs Framework - A lightweight, reactive JavaScript framework for building modern web applications",
55
"type": "module",
66
"main": "./dist/modular-openscriptjs.umd.js",

src/component/Component.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
destroyNodeDeep,
99
getOjsChildren,
1010
} from "../utils/helpers.js";
11-
import DOM from "../utils/DOM.js";
1211

1312
/**
1413
* Base Component Class
@@ -260,7 +259,7 @@ export default class Component {
260259
if (!parent) parent = h.dom;
261260

262261
return parent.querySelectorAll(
263-
`ojs-${this.kebab(this.name)}[uid="${this.id}"]`,
262+
`ojs-${this.kebab(this.name)}[ojs-uid="${this.id}"]`,
264263
);
265264
}
266265

@@ -411,7 +410,7 @@ export default class Component {
411410

412411
let current =
413412
h.dom.querySelectorAll(
414-
`ojs-${this.kebab(this.name)}[uid="${
413+
`ojs-${this.kebab(this.name)}[ojs-uid="${
415414
this.id
416415
}"][s-${stateId}="${stateId}"]`,
417416
) ?? [];
@@ -462,7 +461,7 @@ export default class Component {
462461
}
463462

464463
let attr = {
465-
uid: uuid,
464+
ojs_uid: uuid,
466465
resetParent,
467466
replaceParent,
468467
firstOfParent,
@@ -593,7 +592,7 @@ export default class Component {
593592
children.forEach((child) => {
594593
let component = container
595594
.resolve("repository")
596-
.findComponent(child.getAttribute("uid"));
595+
.findComponent(child.getAttribute("ojs-uid"));
597596
if (component) component.emit(this.EVENTS.mounted, component.id);
598597
});
599598
}

src/component/MarkupEngine.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,12 @@ export default class MarkupEngine {
449449
* @param {function} f - This function should return an HTMLElement or a string or an Array of either
450450
* @returns {HTMLElement|string|Array<HTMLElement|string>}
451451
*/
452-
call = (
453-
f = () => {
452+
call = (f = null) => {
453+
if (!f) {
454454
const h = container.resolve("h");
455455
return h["ojs-group"]();
456-
},
457-
) => {
456+
}
457+
458458
return f();
459459
};
460460

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ const observer = new MutationObserver((mutations) => {
262262

263263
if (/OJS-.*/g.test(node.nodeName)) {
264264
node.querySelectorAll(".__ojs-c-class__").forEach((n) => {
265-
let uid = Number(n.getAttribute("uid"));
265+
let uid = Number(n.getAttribute("ojs-uid"));
266266
let instance = component(uid);
267267

268268
if (!instance) return;
269269
instance.unmount();
270270
app("repository").removeComponent(uid);
271271
});
272272

273-
let uid = Number(node.getAttribute("uid"));
273+
let uid = Number(node.getAttribute("ojs-uid"));
274274

275275
if (uid) {
276276
let instance = component(uid);

0 commit comments

Comments
 (0)