DOM ownership contract
experimental
The grid owns its root, sets one attribute on the container and exposes toolbar, empty and footer slots.
Live example
Expected behavior
The overlay shows owned regions (solid) and consumer slots (dashed). A foreign node injected into the owned body triggers a warning and is removed on the next render. Slot content persists across re-renders.
Source
const dom = await mountGridDom(api, {
container,
classPrefix: 'demo-grid',
label: 'Products',
});
dom.setSlot('toolbar', toolbarNode); // identity kept across renders
dom.getRootElement(); // role="grid", owned by the gridconst dom = await mountGridDom(api, {
container,
classPrefix: 'demo-grid',
label: 'Products',
});
dom.setSlot('toolbar', toolbarNode); // identity kept across renders
dom.getRootElement(); // role="grid", owned by the gridconst dom = await mountGridDom(api, {
container,
classPrefix: 'demo-grid',
label: 'Products',
});
dom.setSlot('toolbar', toolbarNode); // identity kept across renders
dom.getRootElement(); // role="grid", owned by the gridconst dom = await mountGridDom(api, {
container,
classPrefix: 'demo-grid',
label: 'Products',
});
dom.setSlot('toolbar', toolbarNode); // identity kept across renders
dom.getRootElement(); // role="grid", owned by the grid// JavaScript interop module
const dom = await mountGridDom(api, {
container,
classPrefix: 'demo-grid',
label: 'Products',
});
dom.setSlot('toolbar', toolbarNode); // identity kept across renders
dom.getRootElement(); // role="grid", owned by the gridAPI reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Function | mountGridDom | — | Attaches the DOM renderer to a container. |
| Attribute | data-wargrid-owned | — | Marks grid-owned nodes and the container. |
| Method | setSlot | — | Fills the toolbar, empty or footer slot. |
| Method | getRootElement | — | Returns the grid root element. |
| Option | classPrefix | — | Scopes every class set by the grid. |