Repository navigation
XON 2.1.0
Faster
- Lists: rows are clones of one prepared row; only the values that changed are written. 1,000 rows: create
16.5 ms (was 28.2), replace 18.5 (25.3), append 9.4 (18.2), update every 10th 1.3 (8.5), swap 1.0 (5.0),
remove one 0.55 (3.4) - median of 7 cold runs at CPU 1x. - Start-up: a page with 10,000 elements is ready in 15.7 ms (was 66.8); no XPath scan, wiring waits for idle time.
- State: a write through a store's own proxy is a plain write; 10,000 writes to 100 bindings 4.1 ms (was 13.8).
- First click: the event path is prepared at start; 0.28 ms on the last of 1,000 elements (was 5.7).
- Memory: no weak-table entry per row; 200 create + clear cycles grow the heap by about 0.2 MB (was 0.7).
Added
- Boot build (optional):
dist/xon.boot.min.js, 5.4 KB gzip, starts in about 3 ms and loads the engine
(dist/parts/xon.engine.min.js, the same code as the core) in idle time or on first use. Events that arrive
first are queued with the facts of their moment and replayed by the engine, which checks them as usual.
See docs/parts.md, "Boot build". xon.ready(fn): runsfn(xon)once XON runs (boot build: once the engine has arrived; core: at once); returns a
promise. The same page works with either build.- Budget tests for swap, remove, first click, the boot build, and tighter list / write / memory budgets.
Security
- The script tag can not be faked (S21-01). XON reads its own
<script>tag through the browser's real
document.currentScriptand only when it is a script element. Markup before the tag (<img name="currentScript" data-parts="/uploads/" data-debug>, DOM clobbering) chose the parts folder - in the boot build the engine itself -
data-path,data-trustand debug mode; it no longer can. The engine of the boot build checks the tag it is handed. - Addresses are checked as a whole (S21-02). A list blank in an address attribute is judged by the whole address
the attribute gets, in both list forms and in:attr:href="{a}{b}"withjava+script:…, or a blank before
literal text, can not make a script address (the blank becomes#). The values an SVG<set>/<animate>writes
(to,from,by,values) are checked as addresses;srcdocandattributeNamenever take a blank. :attr/data-attr-*may not set an attribute XON reads (S21-03):data-on-*,data-load*,data-each,
data-xon,data-text,data-every… (XON194), so data can not pick the function a click calls.- Boot build: the hand-over is the engine's only (S21-04). It is given only to the engine script the boot file made,
while it runs; a page script callingxon.__boot()gets nothing (no Trusted Types policy, no queue). The boot's
policy accepts script addresses of the site (or of the boot file's site) only. - An element named
xonis not XON (S21-05):<form id="xon"><input name="version">…no longer switches XON off. - Boot build: a write through an object that inherits from a store lands on that object, as with the core (S21-06);
every documented function of the API exists before the engine (S21-07, see below).
Fixed
- Lists made of another store's items (
t.open = t.items.filter(…),t.sel = [t.items[0]]) follow a change of an
item again (2.1 regression). - Boot build: text typed and boxes ticked before the engine arrive stay (they were wiped by the
data-modelbindings);
when the engine can not be loaded (offline, 404) held links and forms work as plain HTML and the problem is reported
once throughxon.onError/xon:error(XON233); the engine is also looked for next to the boot file when the
data-partsfolder has none; a full queue no longer drops a click or holds a link forever (typing is kept per field,
a click or submit takes the place of old typing, an event that is not queued is not held); a person's form or link
whose moment is too old to write (engine took over 10 s) is sent / followed by the browser instead of being lost;
data-ifcontent anddata-eachrow markup are not shown before the engine;data-togglegets its
aria-expanded/aria-controlsbefore the engine. - Boot build: every documented function of the API (
xon.http.request,xon.ui.*,xon.validate,xon.native,
xon.template.*…) exists before the engine; calls are queued and made on it, in order. - A
data-on-*value that is not a plain name (data-on-click="hit()") is reported when the page loads, not at the
first click. e.stopPropagation()in a handler stops an outerdata-on-click.
Changed
- The size limit of the core is 30,720 bytes gzip (was 27,648) for the new list engine and fast paths. The engine part
of the boot build has its own budget: the core limit plus 512 bytes for the hand-over glue. - The type checks of
xon.utils(isFunction,isObject,isArray,isNumeric,isJson,lookup,
functionExists) are in the dashboard build only; nothing in the core used them. - Without
data-each-key, what a visitor did inside a row (an unbound ticked box, an open<details>) stays at its
position when items are added or reordered (2.0.1 reset it); docs/guide.md says so next todata-each-key. - Production builds are ES2015.
Full benchmark (10 libraries + Next.js): bench/RESULTS.md