*be-it* is a vaguely named custom enhancement for DOM elements, whose mission is rather obscure but quite important. It allows deriving and forwarding [microdata](https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata) values from meta and link tags
npm install be-ithtml
be-scoped='{
"count": 30,
"description": "Mr. Banks flying a kite with his kids.",
"isHappy": true
}'
be-sharing='
Share * from scope.
'
>
be-it also supports hydrating the value in the opposite direction from server rendered HTML:
`html
`
...updates the microdata so it matches the initial values of the input element.
Auto-forwarding property to next element sibling:
`html
`
be-it skips over other link/meta tags when searching for the target element to apply the property to.
To specify, instead, to pass the property to the previous element sibling, or the parent, you will need to switch to JSON mode:
`html
`
Auto-forwarding property to other peer elements
be-it also supports passing the value to multiple elements within the parent element scope, based on markers:
`html
`
These marker-based bindings are given lower priority compared to the primary binding (subject to change).
Editing JSON-in-html can be rather error prone. A VS Code extension is available to help with that, and is compatible with web versions of VSCode.
Deriving initial value from SSR
As mentioned above, to support hydrating from server rendered HTML, add the "cloud with lightning" emoji (on windows, flying window + "." and search for cloud with lightning).
`html
`
Two-way binding
be-it supports a two way binding option if the name of the property to share ends with a 🔃 character. (On windows, type flying window + ".", and search for clockwise vertical arrow.)
`html
`
This will cause the checkbox to notify the source's isHappy property of the change.
Conditionally displaying a template element
`html
`
Transforming peer elements [TODO]
be-it can also disseminate its value to other peer elements within the Shadow DOM realm, using DTR syntax:
`html
`
If different values should be passed based on whether the value of itemprop is truthy or falsy, use the transformIfTruthy, transformIfFalsy properties.
Viewing Your Element Locally
1. Install git.
2. Fork/clone this repo.
3. Install node.h
4. Open command window to folder where you cloned this repo.
5. > npm install
6. > npm run serve
7. Open http://localhost:3030/demo/ in a modern browser.
Running Tests
`
> npm run test
``