Skip to content

Conversation

@benjifs
Copy link
Contributor

@benjifs benjifs commented Jun 20, 2025

Fixes #400

Checklist

  • Added validaton to any changes in the parser API.
  • Added tests covering the parsing behaviour changes.
  • Linked to any relevant issues this will close.
  • Tested the output using the demo.

Empty alt text (<img alt="" .../>) is used for implied name properties but the spec specifically mentions not using an empty value.

Also changed the behavior to use impliedTextContent instead of textContent when parsing p-* otherwise it adds the images src when parsing.

Example input covered by new behaviour

<a class="p-author h-card u-url" href="/">
  Author
  <img class="u-photo" src="/photo.jpg" alt="" />
</a>

Example output from new behaviour

{
  "items": [
    {
      "type": ["h-card"],
      "properties": {
        "photo": ["http://example.com/photo.jpg"],
        "name": ["Author"]
      }
    }
  ]
}

@aimee-gm aimee-gm self-assigned this Jun 27, 2025
@aimee-gm aimee-gm merged commit 1e4a025 into microformats:main Jun 27, 2025
7 checks passed
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.

Empty alt text is overriding h-card name and value

2 participants