Skip to content

Passes: null in URL attribute drops it like in other attributes - #428

Open
vrana wants to merge 2 commits into
nette:masterfrom
vrana:check-url-null
Open

vrana wants to merge 2 commits into
nette:masterfrom
vrana:check-url-null

Conversation

@vrana

@vrana vrana commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

dg and others added 2 commits July 31, 2026 19:48
…boolean attributes (BC break)

None of them is a boolean attribute in HTML; they are enumerated ones, so
rendering them as a bare name was wrong in three separate ways:

- a string 'false' is truthy in PHP, so contenteditable={$s} rendered the
  attribute present, i.e. the exact opposite of what was asked for
- the empty value is not a keyword of draggable, it maps to the invalid value
  default 'auto', so draggable=true could not be expressed at all
- 'attribute missing' and 'attribute false' are different states; the false
  value is what disables editing inside a contenteditable region, and dropping
  the attribute silently inherited from the parent instead

Two new categories replace them. 'tristate' (contenteditable, draggable,
spellcheck, writingsuggestions) maps bool to the true/false keywords, exactly
like aria-* already does, so formatAriaAttribute now delegates to it. The
'valuedBool' one (hidden, popover) stays a flag but keeps a non-empty value,
so hidden="until-found" survives. Falsy values are tested first there: hidden
with a '0' coming from a database must not render hidden="0", which is an
invalid value and would map back to the hidden state.
…reak)

Since 3.1, a null value of an attribute means the attribute is omitted. URL
attributes were an exception: the checkUrls pass appends |checkUrl, which
converts null to '', so <a href={$url}> with null rendered href="". That
makes the element a link to the current page.

The pass now appends the filter as nullsafe ?|checkUrl, so null skips it and
the attribute is dropped. With migration warnings, the change is reported like
for other attributes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants