Skip to content

Commit 6d4fcda

Browse files
committed
docs: cite Glimmer VM source verifying autofocus={{false}} omits attribute
The G3 exemption's load-bearing premise (Glimmer renders no attribute when given a mustache-literal false) was asserted in the PR body but unverified in the rule's own documentation. Verified against Glimmer VM's attribute-normalization path: glimmer-vm/packages/@glimmer/runtime/lib/vm/attributes/dynamic.ts `normalizeValue` returns null for false/undefined/null; then `SimpleDynamicAttribute.update()` calls element.removeAttribute(name) when the value is null. So autofocus={{false}} genuinely omits the attribute from the rendered DOM — not autofocus="false". Inlined the citation into the rule's JSDoc so future readers don't have to trace it.
1 parent 1670293 commit 6d4fcda

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/rules/template-no-autofocus-attribute.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
* syntax — Glimmer authors writing `autofocus={{false}}` are expressing
1414
* intent to omit the attribute conditionally. Treat that narrow literal
1515
* case as opt-out (the rendered HTML will have no autofocus attr).
16+
*
17+
* Verified against Glimmer VM's attribute-normalization source:
18+
* glimmer-vm/packages/@glimmer/runtime/lib/vm/attributes/dynamic.ts —
19+
* `normalizeValue` returns `null` for `false | undefined | null`, and
20+
* `SimpleDynamicAttribute.update()` calls `element.removeAttribute(name)`
21+
* when the normalized value is null. So `autofocus={{false}}` renders
22+
* with the attribute entirely absent from the DOM.
1623
*/
1724
function isMustacheBooleanFalse(value) {
1825
if (value?.type !== 'GlimmerMustacheStatement') {

0 commit comments

Comments
 (0)