neobiz 4.7.0 → 5.0.1
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/{browser.js → browser_v4.js} +1 -1
- package/example/async_components.v.js +88 -0
- package/example/basic_syntax.v.js +86 -22
- package/example/control_flow.v.js +89 -54
- package/example/fromString.v.js +63 -20
- package/example/interact_withDOM.v.js +79 -10
- package/example/loop_and_Array.v.js +94 -46
- package/example/style.v.js +118 -24
- package/index.js +1 -20
- package/index2.js +859 -0
- package/indexw.js +21 -0
- package/package.json +1 -1
- package/readme.md +502 -534
- package/readme_v4.md +735 -0
- package/example/boolean_attributes.js +0 -17
- package/example/explicit-tag.v..js +0 -16
- package/example/innerText&html.v.js +0 -15
- package/example/multi_tag.v.js +0 -13
- package/example/orderChild.v.js +0 -15
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "../index.js";
|
|
2
|
+
|
|
3
|
+
// Configure output for clean snippet inspection
|
|
4
|
+
renderOption({
|
|
5
|
+
nodoctype: true,
|
|
6
|
+
pretty: true,
|
|
7
|
+
indentSize: 2,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// Simulated asynchronous data sources
|
|
11
|
+
const fetchProfile = async (userId) => {
|
|
12
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
13
|
+
return { id: userId, name: "Alice", role: "Lead Engineer" };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const fetchNotifications = async () => {
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
18
|
+
return [
|
|
19
|
+
{ id: 1, message: "Deployment succeeded" },
|
|
20
|
+
{ id: 2, message: "New comment on PR #42" },
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// 1. EMBEDDING PROMISES DIRECTLY IN THE VIEW TREE (`_renderAsync`)
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// All Promises in the tree are resolved in parallel via `Promise.all` before rendering.
|
|
28
|
+
const asyncProfileCard = {
|
|
29
|
+
"section.profile-card": {
|
|
30
|
+
// Promise resolving to a child object
|
|
31
|
+
header: fetchProfile(101).then((user) => ({
|
|
32
|
+
h2: { text: user.name },
|
|
33
|
+
"span.badge": { text: user.role },
|
|
34
|
+
})),
|
|
35
|
+
|
|
36
|
+
// Promise resolving to an array of sibling elements
|
|
37
|
+
"ul.notifications": {
|
|
38
|
+
li: fetchNotifications().then((items) =>
|
|
39
|
+
items.map((item) => ({
|
|
40
|
+
id: `notif-${item.id}`,
|
|
41
|
+
text: item.message,
|
|
42
|
+
}))
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
console.log("--- 1. Embedded Promises with `_renderAsync` ---");
|
|
49
|
+
console.log(await asyncProfileCard._renderAsync);
|
|
50
|
+
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// 2. ASYNC COMPONENT FUNCTIONS
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// Async components return Promises that resolve to Neobiz objects and compose naturally
|
|
55
|
+
const AsyncUserStats = async (userId) => {
|
|
56
|
+
const user = await fetchProfile(userId);
|
|
57
|
+
return {
|
|
58
|
+
"div.stats-box": {
|
|
59
|
+
p: { text: `Active Session: ${user.name} (ID: #${user.id})` },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const AsyncFeedList = async () => {
|
|
65
|
+
const notes = await fetchNotifications();
|
|
66
|
+
return {
|
|
67
|
+
"ul.feed": {
|
|
68
|
+
li: {
|
|
69
|
+
each: notes,
|
|
70
|
+
text: "$item.message",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const dashboardPage = {
|
|
77
|
+
"main#dashboard": {
|
|
78
|
+
h1: { text: "System Overview" },
|
|
79
|
+
// Both async components execute concurrently
|
|
80
|
+
$: [
|
|
81
|
+
AsyncUserStats(202),
|
|
82
|
+
AsyncFeedList(),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
console.log("\n--- 2. Concurrent Async Components ---");
|
|
88
|
+
console.log(await dashboardPage._renderAsync);
|
|
@@ -1,25 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
import "../index.js";
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// Configure output for clean snippet inspection (omit DOCTYPE, format with 2 spaces)
|
|
4
|
+
renderOption({
|
|
5
|
+
nodoctype: true,
|
|
6
|
+
pretty: true,
|
|
7
|
+
indentSize: 2,
|
|
8
|
+
});
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
// 1. Basic Element & Text Escaping (`text` vs `html`)
|
|
11
|
+
const textAndHtml = {
|
|
12
|
+
div: {
|
|
13
|
+
// `text` escapes HTML characters automatically to prevent XSS
|
|
14
|
+
h1: { text: "Hello World! <b>This is escaped plain text</b>" },
|
|
15
|
+
// `html` injects raw unescaped HTML strings
|
|
16
|
+
p: { html: "This is rendered as <strong>raw HTML</strong>." },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
console.log("--- 1. Text & Raw HTML ---");
|
|
21
|
+
console.log(textAndHtml._render);
|
|
22
|
+
|
|
23
|
+
// 2. Standard & Boolean Attributes (`Null`, `true`, `false`)
|
|
24
|
+
const attributesExample = {
|
|
25
|
+
form: {
|
|
26
|
+
input: {
|
|
27
|
+
type: "text",
|
|
28
|
+
id: "username",
|
|
29
|
+
class: "form-input",
|
|
30
|
+
placeholder: "Enter your username",
|
|
31
|
+
style: "border: 1px solid #ccc; padding: 6px;",
|
|
32
|
+
required: Null, // Renders valueless attribute: required
|
|
33
|
+
readonly: true, // Renders valueless attribute: readonly
|
|
34
|
+
disabled: false, // Omitted completely
|
|
35
|
+
},
|
|
36
|
+
button: {
|
|
37
|
+
type: "submit",
|
|
38
|
+
text: "Submit",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
console.log("\n--- 2. Standard & Boolean Attributes ---");
|
|
44
|
+
console.log(attributesExample._render);
|
|
45
|
+
|
|
46
|
+
// 3. Nested Elements & Expressions
|
|
47
|
+
const nestedAndExpressions = {
|
|
48
|
+
section: {
|
|
49
|
+
h2: { text: "Calculated Values" },
|
|
50
|
+
p: {
|
|
51
|
+
span: [
|
|
52
|
+
{ text: `Result: ${24 + 12 / 6} | ` },
|
|
53
|
+
{ text: `Active: ${!false}` },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
console.log("\n--- 3. Nested Elements & Expressions ---");
|
|
60
|
+
console.log(nestedAndExpressions._render);
|
|
61
|
+
|
|
62
|
+
// 4. Sibling Elements (Array, Space-Suffix Keys, & Explicit `tag`)
|
|
63
|
+
const siblingsExample = {
|
|
64
|
+
ul: {
|
|
65
|
+
// Array for consecutive identical tags
|
|
66
|
+
li: [
|
|
67
|
+
{ text: "Apple" },
|
|
68
|
+
{ text: "Banana" },
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
// Different element in the middle of the list
|
|
72
|
+
p: {
|
|
73
|
+
span: { text: "Divider between list items" },
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
// Trailing space in key name to avoid duplicate JS object keys
|
|
77
|
+
"li ": { text: "Cherry" },
|
|
78
|
+
|
|
79
|
+
// Explicit `tag` property with a custom key name
|
|
80
|
+
lastItem: {
|
|
81
|
+
tag: "li",
|
|
82
|
+
class: "last",
|
|
83
|
+
text: "Dragonfruit",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
6
87
|
|
|
7
|
-
console.log(
|
|
8
|
-
|
|
9
|
-
h1: { text: "Hello World!" },
|
|
10
|
-
}.render
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
//output: <h1>Hello World!</h1>
|
|
14
|
-
|
|
15
|
-
// output static file
|
|
16
|
-
console.log(
|
|
17
|
-
{
|
|
18
|
-
h1: { text: "Hello World!" },
|
|
19
|
-
}.outFile("./basic_syntax.html")
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
// properties
|
|
23
|
-
const page = {
|
|
24
|
-
h1: { class: "heading", id: "main", text: "Hello World!" },
|
|
25
|
-
}.render;
|
|
88
|
+
console.log("\n--- 4. Sibling Elements & Explicit Tags ---");
|
|
89
|
+
console.log(siblingsExample._render);
|
|
@@ -1,56 +1,91 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
|
|
3
1
|
import "../index.js";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
3
|
+
// Configure output for clean snippet inspection
|
|
4
|
+
renderOption({
|
|
5
|
+
nodoctype: true,
|
|
6
|
+
pretty: true,
|
|
7
|
+
indentSize: 2,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// 1. Declarative Conditional Rendering (`when`)
|
|
11
|
+
// Cleanly include or omit elements without ternary operators or wrapper functions
|
|
12
|
+
const isLoggedIn = true;
|
|
13
|
+
const isAdmin = false;
|
|
14
|
+
|
|
15
|
+
const declarativeWhen = {
|
|
16
|
+
nav: {
|
|
17
|
+
a: { href: "/", text: "Home" },
|
|
18
|
+
// Rendered because `when` is truthy
|
|
19
|
+
button: {
|
|
20
|
+
when: isLoggedIn,
|
|
21
|
+
text: "Logout",
|
|
22
|
+
},
|
|
23
|
+
// Omitted completely because `when` is falsy
|
|
24
|
+
"a ": {
|
|
25
|
+
when: isAdmin,
|
|
26
|
+
href: "/admin",
|
|
27
|
+
text: "Admin Dashboard",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
console.log("--- 1. Declarative `when` ---");
|
|
33
|
+
console.log(declarativeWhen._render);
|
|
34
|
+
|
|
35
|
+
// 2. Conditional Fragments (`$` + `when`)
|
|
36
|
+
// Toggle multiple sibling elements at once without adding a wrapper tag
|
|
37
|
+
const hasNotification = true;
|
|
38
|
+
const unreadCount = 3;
|
|
39
|
+
|
|
40
|
+
const conditionalFragment = {
|
|
41
|
+
header: {
|
|
42
|
+
h1: { text: "Dashboard" },
|
|
43
|
+
$: {
|
|
44
|
+
when: hasNotification,
|
|
45
|
+
span: { class: "badge", text: `${unreadCount} unread messages` },
|
|
46
|
+
button: { text: "Mark all as read" },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
console.log("\n--- 2. Conditional Fragment (`$` + `when`) ---");
|
|
52
|
+
console.log(conditionalFragment._render);
|
|
53
|
+
|
|
54
|
+
// 3. Ternary Operator (Inline Branching)
|
|
55
|
+
// Best used when switching between two different element structures
|
|
56
|
+
const isOnline = false;
|
|
57
|
+
|
|
58
|
+
const ternaryBranching = {
|
|
59
|
+
div: {
|
|
60
|
+
status: isOnline
|
|
61
|
+
? { tag: "span", class: "online", text: "User is Online" }
|
|
62
|
+
: { tag: "a", href: "/reconnect", text: "Offline - Click to Reconnect" },
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
console.log("\n--- 3. Ternary Branching ---");
|
|
67
|
+
console.log(ternaryBranching._render);
|
|
68
|
+
|
|
69
|
+
// 4. Multi-Branch Logic (`if / else` & `switch`)
|
|
70
|
+
// Best used for complex role/state matching before building the view tree
|
|
71
|
+
const userRole = "editor";
|
|
72
|
+
|
|
73
|
+
function renderRoleBadge(role) {
|
|
74
|
+
switch (role) {
|
|
75
|
+
case "admin":
|
|
76
|
+
return { class: "badge-red", text: "Administrator" };
|
|
77
|
+
case "editor":
|
|
78
|
+
return { class: "badge-blue", text: "Content Editor" };
|
|
79
|
+
default:
|
|
80
|
+
return { class: "badge-gray", text: "Viewer" };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const multiBranch = {
|
|
85
|
+
div: {
|
|
86
|
+
span: renderRoleBadge(userRole),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
console.log("\n--- 4. Multi-Branch (`switch` / `if-else`) ---");
|
|
91
|
+
console.log(multiBranch._render);
|
package/example/fromString.v.js
CHANGED
|
@@ -1,27 +1,70 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
|
|
3
1
|
import "../index.js";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</
|
|
3
|
+
// Configure output for clean snippet inspection
|
|
4
|
+
renderOption({
|
|
5
|
+
nodoctype: true,
|
|
6
|
+
pretty: true,
|
|
7
|
+
indentSize: 2,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// 1. Basic HTML-to-Object Conversion (`.repulse`)
|
|
11
|
+
// Parses tags, nested children, attributes, boolean attributes, and comments
|
|
12
|
+
const rawHtml = `
|
|
13
|
+
<article class="post-card" data-published>
|
|
14
|
+
<!-- Post Header -->
|
|
15
|
+
<h1>Understanding Neobiz.js</h1>
|
|
16
|
+
<p>First paragraph of the article.</p>
|
|
17
|
+
<p>Second paragraph (automatically keyed with trailing space).</p>
|
|
18
|
+
<img src="/cover.jpg" alt="Cover Image" />
|
|
19
|
+
</article>
|
|
18
20
|
`;
|
|
19
21
|
|
|
20
|
-
const
|
|
22
|
+
const parsedObj = rawHtml.repulse;
|
|
23
|
+
|
|
24
|
+
// Inspect the generated Neobiz object structure
|
|
25
|
+
console.log("--- 1. Parsed Neobiz Object ---");
|
|
26
|
+
console.dir(parsedObj, { depth: null });
|
|
27
|
+
|
|
28
|
+
// 2. Mutating Parsed Elements Directly
|
|
29
|
+
// Duplicate sibling tags are indexed with trailing spaces ("p", "p ", "p ")
|
|
30
|
+
parsedObj.article.id = "featured-post";
|
|
31
|
+
parsedObj.article.h1.class = "post-title";
|
|
32
|
+
parsedObj.article["p "].style = { color: "#2563eb", fontWeight: "bold" }.cssText;
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
// Append a new child node before rendering back to HTML
|
|
35
|
+
parsedObj.article.footer = {
|
|
36
|
+
span: { text: "Published in 2026" },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
console.log("\n--- 2. Modified & Re-rendered HTML ---");
|
|
40
|
+
console.log(parsedObj._render);
|
|
41
|
+
|
|
42
|
+
// 3. Combining `.repulse` with `.query()` for Deep / Bulk Modifications
|
|
43
|
+
// Ideal when modifying complex HTML templates without manually traversing nested keys
|
|
44
|
+
const legacyTemplate = `
|
|
45
|
+
<section class="gallery">
|
|
46
|
+
<div class="item">
|
|
47
|
+
<img src="/photo-1.jpg" alt="Photo 1" />
|
|
48
|
+
<a href="https://example.com">View Original</a>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="item">
|
|
51
|
+
<img src="/photo-2.jpg" alt="Photo 2" />
|
|
52
|
+
<a href="/local-page">Internal Link</a>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
`;
|
|
24
56
|
|
|
25
|
-
|
|
57
|
+
const enhancedGallery = legacyTemplate.repulse
|
|
58
|
+
.query("img", (img) => {
|
|
59
|
+
img.loading = "lazy";
|
|
60
|
+
img.decoding = "async";
|
|
61
|
+
})
|
|
62
|
+
.query("a", (link) => {
|
|
63
|
+
if (link.href?.startsWith("http")) {
|
|
64
|
+
link.target = "_blank";
|
|
65
|
+
link.rel = "noopener noreferrer";
|
|
66
|
+
}
|
|
67
|
+
});
|
|
26
68
|
|
|
27
|
-
console.
|
|
69
|
+
console.log("\n--- 3. Enhanced via `.repulse` + `.query()` ---");
|
|
70
|
+
console.log(enhancedGallery._render);
|
|
@@ -1,18 +1,87 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
|
|
3
1
|
import "../index.js";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
// Configure output for clean snippet inspection
|
|
4
|
+
renderOption({
|
|
5
|
+
nodoctype: true,
|
|
6
|
+
pretty: true,
|
|
7
|
+
indentSize: 2,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// 1. INLINE EVENTS (`on*`) & STATIC CLOSURE INJECTION (`bind`)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// In inline event handlers, `this` always refers to the DOM element itself.
|
|
14
|
+
// Use `bind` to serialize outer variables directly into the static HTML handler.
|
|
15
|
+
|
|
16
|
+
const ProductButton = (product, taxRate) => ({
|
|
6
17
|
button: {
|
|
7
|
-
|
|
18
|
+
class: "btn-checkout",
|
|
19
|
+
text: `Buy ${product.name} ($${product.price})`,
|
|
20
|
+
// Inject external variables into the inline `onclick` scope
|
|
21
|
+
bind: { product, taxRate },
|
|
8
22
|
onclick() {
|
|
9
|
-
|
|
23
|
+
const total = (product.price * (1 + taxRate)).toFixed(2);
|
|
24
|
+
this.textContent = `Added! ($${total} incl. tax)`;
|
|
25
|
+
this.disabled = true;
|
|
10
26
|
},
|
|
11
|
-
id: "example",
|
|
12
27
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const staticView = {
|
|
31
|
+
div: {
|
|
32
|
+
// Simple inline event using `this`
|
|
33
|
+
input: {
|
|
34
|
+
type: "password",
|
|
35
|
+
placeholder: "Press Enter to preview",
|
|
36
|
+
onkeypress() {
|
|
37
|
+
if (event.key === "Enter") alert(this.value);
|
|
38
|
+
},
|
|
16
39
|
},
|
|
40
|
+
// Component with `bind` closure injection
|
|
41
|
+
$: ProductButton({ id: 42, name: "Mechanical Keyboard", price: 120 }, 0.1),
|
|
17
42
|
},
|
|
18
|
-
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
console.log("--- 1. Events & `bind` Output ---");
|
|
46
|
+
console.log(staticView._render);
|
|
47
|
+
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// 2. ISOMORPHIC `.query()` & DOM HELPERS (Browser Runtime)
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// `.query(selector, callback)` works identically on pre-render Neobiz objects
|
|
52
|
+
// and live Browser DOM nodes (`document` / `Element`).
|
|
53
|
+
|
|
54
|
+
if (typeof document !== "undefined") {
|
|
55
|
+
// A. Querying from `document` by class and ID
|
|
56
|
+
document
|
|
57
|
+
.query("input.form-control", (inputEl) => {
|
|
58
|
+
inputEl.style.border = "1px solid #3b82f6";
|
|
59
|
+
inputEl.style.padding = "8px";
|
|
60
|
+
})
|
|
61
|
+
.query("#btn-load-more", (btnEl) => {
|
|
62
|
+
btnEl.addEventListener("click", () => {
|
|
63
|
+
// B. Scoped query inside a specific parent element + `.appendObj()`
|
|
64
|
+
document.query("#item-list", (listEl) => {
|
|
65
|
+
listEl.appendObj({
|
|
66
|
+
"li.list-item": {
|
|
67
|
+
span: { text: "Dynamically appended item " },
|
|
68
|
+
button: {
|
|
69
|
+
text: "Remove",
|
|
70
|
+
onclick() {
|
|
71
|
+
this.parentElement.remove();
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// C. Replacing entire innerHTML of a live DOM element with `.htmlObj`
|
|
81
|
+
const statusContainer = document.getElementById("status-box");
|
|
82
|
+
if (statusContainer) {
|
|
83
|
+
statusContainer.htmlObj = {
|
|
84
|
+
"p.text-success": { text: "DOM updated via Neobiz object!" },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|