be-observant is an HTML enhancement that reflects peer elements or the host's properties to data-* attributes. This is useful for styling, among other reasons.
<label>
a: <input id=a>
</label>
<label>
b: <input id=b type=checkbox>
</label>
<label>
c: <input id=c type=number>
</label>
<label>
d: <input id=d type=date>
</label>
<div be-observant="of #a and #b and #c and #d"></div>What this does:
sets data-[id] of the adorned element to the value of the input element:
<div data-a=... data-b=... data-c=... data-d=...>For more compact notation, consider importing an alternative name via the reference 'be-observant/👀.js'. Also, the word and is optional. So this also works:
<label>
a: <input id=a>
</label>
<label>
b: <input id=b type=checkbox>
</label>
<label>
c: <input id=c type=number>
</label>
<label>
d: <input id=d type=date>
</label>
<div 👀="of #a #b #c and #d"></div>Any web server that can serve static files with server side includes will do, but...
- Install git.
- Fork/clone this repo.
- Install node.js.
- Install python 3 or later.
- Open command window to folder where you cloned this repo.
-
npm install
-
npm run serve
- Open http://localhost:8000/demo/ in a modern browser.
> npm run test
import 'be-observant/emc.js';or
import 'be-observant/🔭.js';<script type=module crossorigin=anonymous>
import 'https://esm.run/be-observant';
</script>