You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -376,7 +376,18 @@ Schemas validate the tag's flat attribute object. The tag name is implicit from
376
376
}
377
377
```
378
378
379
-
Attribute values are coerced by JSON Schema (`"2"` can satisfy an integer, valueless attributes become `true`). Attribute values containing mustache are treated as unknown runtime values, so value-dependent schema errors are waived while presence and unknown-attribute checks still run.
379
+
Attribute values are coerced by JSON Schema (`"2"` can satisfy an integer, boolean attributes become `true`). Attribute values containing mustache are treated as unknown runtime values, so value-dependent schema errors are waived while presence and unknown-attribute checks still run.
380
+
381
+
HTML boolean attributes are allowed on custom tags by default, so `<pl-answer correct>` validates as `{ "correct": true }`. To require explicit values for custom tag attributes by default, set `customTagDefaults.allowBooleanAttributes` to `false`; individual custom tag entries can opt back in:
When boolean attributes are disabled for a custom tag, `<pl-answer correct>` reports `Attribute "correct" on <pl-answer> must have a value.` Ordinary HTML boolean attributes such as `<input disabled>` are not affected by this custom tag setting.
380
391
381
392
Custom tags can also declare parent-owned child schemas. Child schemas validate a direct child tag's flat attribute object only in the context of that parent:
382
393
@@ -470,6 +481,7 @@ Schema diagnostics are phrased in HTML/element terms rather than JSON-Schema voc
470
481
| strict unlisted child |`<pl-multiple-choice> only allows these child elements: <pl-answer>.`|
471
482
| child-only tag outside its parent |`<pl-answer> may only appear as a direct child of these parent elements: <pl-multiple-choice>.`|
472
483
| child `additionalProperties`|`Unknown attribute "ranking" on <pl-answer> inside <pl-multiple-choice>.`|
484
+
| custom tag boolean attribute |`Attribute "correct" on <pl-answer> must have a value.`|
473
485
|`properties.display.enum`|`Attribute "display" on <pl-multiple-choice> must be one of: "block", "inline".`|
474
486
|`properties.size.type: "integer"`|`Attribute "size" on <pl-multiple-choice> must be integer.`|
475
487
|`properties.weight.minimum: 0`|`Attribute "weight" on <pl-multiple-choice> must be >= 0.`|
Copy file name to clipboardExpand all lines: docs/superpowers/specs/2026-05-15-boolean-custom-tag-attributes-design.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,15 @@ Child tag entries do not inherit the setting from their parent tag entry. They i
70
70
71
71
If the same child tag is declared under different parents, each child entry may use a different `allowBooleanAttributes` value, matching the existing parent-specific child schema behavior.
72
72
73
+
Example with boolean attributes disabled by default for custom tags, but allowed for `<pl-answer>`:
When the resolved setting for a custom tag entry is `false`, every literal HTML boolean attribute on that element is a `customTagSchema` diagnostic.
@@ -107,6 +116,8 @@ The diagnostic anchors to the boolean attribute node. The check runs before JSON
107
116
108
117
Dynamic or mustache-shaped attributes are unaffected unless they parse as ordinary HTML boolean attributes. For example, `<pl-answer correct="{{value}}">` has a value and is not rejected by this option.
109
118
119
+
Ordinary HTML boolean attributes such as `<input disabled>` are not affected because the option applies only to configured custom tag entries.
0 commit comments