Skip to content

Attribute value "until-found" for hidden attribute is incorrectly normalized #5073

@rururux

Description

@rururux

Description

The hidden="until-found" attribute value (introduced in HTML Living Standard) is not correctly preserved when loading HTML via cheerio.load(). Instead, it is being normalized to hidden or an undefined, treating it as a legacy boolean attribute.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/hidden#description

const html = `
  <!DOCTYPE html>
  <!-- Sample: popover -->
  <dialog id="popover-auto" popover="auto"></dialog>
  <dialog id="popover-true" popover></dialog>
  <dialog id="popover-false"></dialog>
  <dialog id="popover-string-empty" popover></dialog>

  <!-- hidden -->
  <div id="hidden-until-found" hidden="until-found"></div>
  <div id="hidden-true" hidden></div>
  <div id="hidden-false"></div>
  <div id="hidden-string-empty" hidden></div>
`;
~/projects/stackblitz-starters-bnzemr2z
❯ node index.js
{ id: 'popover-auto', expected: 'auto', actual: 'auto' }
{ id: 'popover-true', expected: '', actual: '' }
{ id: 'popover-false', expected: undefined, actual: undefined }
{ id: 'popover-string-empty', expected: '', actual: '' }
{ id: 'hidden-until-found', expected: 'until-found', actual: 'hidden' }
{ id: 'hidden-true', expected: '', actual: 'hidden' }
{ id: 'hidden-false', expected: undefined, actual: undefined }
{ id: 'hidden-string-empty', expected: '', actual: 'hidden' }

https://stackblitz.com/edit/stackblitz-starters-bnzemr2z

Environment

cheerio version: 1.2.0
node version: v24.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions