be-definitive () [TODO]
May 30, 2025 ยท View on GitHub
Example 1: Inferred props
<table>
<thead><th>Name</th><th>SSN Number</th></thead>
<tbody>
<tr data-ld='{"@type": "Person"}' id=temp>
<td itemprop=name>Burt</td>
<td itemprop=ssn>123-45-6789</td>
<script be-definitive='{"inferProps": true}'></script>
</tr>
<tr data-ld='{"@type": "Person", "name": "Sally", "ssn": "987-65-4321"}'>
<template href=#temp></template>
</tr>
<tr data-ld='{"@type": "Person", "name": "Sally", "ssn": "987-65-4321"}'>
<template href=#temp></template>
</tr>
</tbody>
</table>
Only clone the template for other tr's if innerHTML is empty.
<table>
<thead><th>Name</th><th>SSN Number</thead>
<tbody>
<template be-definitive ๐ซ itemscope=my-item itemref="a13245 b39596"></template>
<tr id=a13245 be-definitive>
<td>
<my-item></my-item>
<span itemprop=name>Burt</span>
</td>
<td itemprop=ssn>123-45-6789</td>
</tr>
<tr id=b39596>
<td itemprop=address>654 Penny Lane</td>
<td itemprop=cellphone>345-25-2686<</td>
</tr>
<template itemscope=my-item></template>
</tbody>
</table>
automatically captures the template based on itemref's. Auto expands others
Viewing this element locally
- Install git.
- Fork/clone this repo.
- Install node.
- Open command window to folder where you cloned this repo.
-
npm install
-
npm run serve
- Open http://localhost:3030/demo/dev in a modern browser.
Running Tests
> npm run test
Importing in ES Modules:
import 'be-definitive/be-definitive.js';
Using from CDN:
<script type=module crossorigin=anonymous>
import 'https://esm.run/be-definitive';
</script>
