Skip to content

Commit

Permalink
Dynamic vars > Shared vars
Browse files Browse the repository at this point in the history
  • Loading branch information
inventionpro committed Aug 17, 2024
1 parent f5e7bbd commit 7615d62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/v4.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h2>Cross file contents</h2>
<h2>Static vars</h2>
<rr var="W:parts;">H1</rr>
<rr var="W:things">H2</rr>
<h2>Dynamic vars</h2>
<h2>Shared vars</h2>
<input htms-out="test">
<p htms-in="test"></p>
<h2>Modules</h2>
Expand Down
6 changes: 4 additions & 2 deletions js/v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function SGetSample(args, type) {
}
let sample = imports[args[3]];
if (sample) {
// Static vars
if (elm.getAttribute('var')) {
elm.getAttribute('var')
.split(';')
Expand All @@ -65,6 +66,7 @@ function SGetSample(args, type) {
sample = sample.replaceAll(`\${${t[0]}}`, t[1])
})
}
// Add sample
if (type === 'inject') {
elm.innerHTML = sample;
} else {
Expand Down Expand Up @@ -159,8 +161,8 @@ function SUpdate() {
}
}

// Dynamic vars
const valueElements = ['input', 'textarea', 'select'];
// Shared vars
const valueElements = ['input', 'textarea', 'select', 'meter', 'progress'];
Array.from(document.querySelectorAll('[htms-out]')).forEach(u => {
const tagName = u.tagName.toLowerCase();

Expand Down
2 changes: 1 addition & 1 deletion js/v4.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7615d62

Please sign in to comment.