Summary
Eight low-risk cleanups across shell.js (5) and html.js (3). Net ~600 bytes raw / ~250 minified, no behavior change. One latent bug fixed in passing (multi-island base URL).
shell.js
1. Dead static import + duplicate dynamic import of the same module
```js
// before — line 6 unused; line 58 dynamically re-imports the same module to get Store
import { createStore } from './store.js' // never referenced
const store = new (await import('./store.js')).Store()
// after
import { Store } from './store.js'
const store = new Store()
```
3. Container-ID OR-chain duplicated (boot fallback + auto-boot guard)
```js
// before — same 4-id chain written twice
document.getElementById('solid') || document.getElementById('losos') ||
document.getElementById('mashlib') || document.getElementById('app') || document.body
// after
var IDS = ['solid','losos','mashlib','app']
var findRoot = () => IDS.map(id => document.getElementById(id)).find(Boolean)
```
4. baseUrl resolution duplicated (loadData + resolvePane) — fixes a latent bug
The duplicated logic uses `script[type="application/ld+json"]` (first match), so if the first island is inline and a later one has `src`, baseUrl falls through to `window.location.href`. Single helper using `[type="application/ld+json"][src]` selector targets the right element.
6. Compact `namedNode` from 13 lines to 5
Modern shorthand (arrow fns + property shorthand) — same shape, fewer bytes.
7. Trim WHAT comments on private helpers
JSDoc on `loadData`, `findSubject`, `namedNode`, `loadPanes` describes what their names already say. Keep the WHY comments (data-island `__jsonLd` cache rationale, `?uri=` fragment-detection logic).
`html.js`
1. Trim obvious WHAT comments
Keep WHY for HOLE, the cache-validity guard (#15), the keyed-diff strategy. Drop "Element — check attributes for holes" type comments.
2. DRY nested-template handling
Same logic in array branch (line 254) and single branch (line 277). Extract one `renderInto(parent, after, template)` helper.
3. Replace `arguments` with rest spread in `html()`
```js
// before
export function html(strings) {
var values = []
for (var i = 1; i < arguments.length; i++) values.push(arguments[i])
return { strings: strings, values: values }
}
// after
export function html(strings, ...values) {
return { strings, values }
}
```
Out of scope
Acceptance
Summary
Eight low-risk cleanups across
shell.js(5) andhtml.js(3). Net ~600 bytes raw / ~250 minified, no behavior change. One latent bug fixed in passing (multi-island base URL).shell.js1. Dead static import + duplicate dynamic import of the same module
```js
// before — line 6 unused; line 58 dynamically re-imports the same module to get Store
import { createStore } from './store.js' // never referenced
const store = new (await import('./store.js')).Store()
// after
import { Store } from './store.js'
const store = new Store()
```
3. Container-ID OR-chain duplicated (boot fallback + auto-boot guard)
```js
// before — same 4-id chain written twice
document.getElementById('solid') || document.getElementById('losos') ||
document.getElementById('mashlib') || document.getElementById('app') || document.body
// after
var IDS = ['solid','losos','mashlib','app']
var findRoot = () => IDS.map(id => document.getElementById(id)).find(Boolean)
```
4. baseUrl resolution duplicated (loadData + resolvePane) — fixes a latent bug
The duplicated logic uses `script[type="application/ld+json"]` (first match), so if the first island is inline and a later one has `src`, baseUrl falls through to `window.location.href`. Single helper using `[type="application/ld+json"][src]` selector targets the right element.
6. Compact `namedNode` from 13 lines to 5
Modern shorthand (arrow fns + property shorthand) — same shape, fewer bytes.
7. Trim WHAT comments on private helpers
JSDoc on `loadData`, `findSubject`, `namedNode`, `loadPanes` describes what their names already say. Keep the WHY comments (data-island `__jsonLd` cache rationale, `?uri=` fragment-detection logic).
`html.js`
1. Trim obvious WHAT comments
Keep WHY for HOLE, the cache-validity guard (#15), the keyed-diff strategy. Drop "Element — check attributes for holes" type comments.
2. DRY nested-template handling
Same logic in array branch (line 254) and single branch (line 277). Extract one `renderInto(parent, after, template)` helper.
3. Replace `arguments` with rest spread in `html()`
```js
// before
export function html(strings) {
var values = []
for (var i = 1; i < arguments.length; i++) values.push(arguments[i])
return { strings: strings, values: values }
}
// after
export function html(strings, ...values) {
return { strings, values }
}
```
Out of scope
Acceptance