Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

anchor is renamed to span without removing attribute target

Open Beginner friendly
#5,504 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
html, javascript
Domain
frontend, web-dev

Research direction

Start in src/core/figures.js at the linked lines 115–118 and read how anchor elements in figure captions are transformed for the list of figures. Check which non-global attributes remain after the transformation, including target. Update the removal behavior and run the relevant figure tests; done means the transformed caption link no longer retains attributes that do not apply to the resulting span.

Written by the indexing model from the issue text.

Description

bug

Description of problem

When a figcaption holds an anchor element (using respec html syntax), this element is renamed to a span for the list of figures. Only the href attribute is removed. The removal of attributes should happen for all non global attributes, like target as the user could have used that in his/her document.

<figure id="fig-image">
  <img src="image.png" alt="image alt text" />
  <figcaption>Image with anchor <a href="https://an.url.org/" target="_blank">link</a>.</figcaption>
</figure>

https://github.com/speced/respec/blob/4b35fa2b43891577773e50968e700e6145d12baf/src/core/figures.js#L115-L118

See https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element for possible attributes.

What happened (e.g., it crashed)?:
Not able to create correct respec output when using a hyperlink in a figcaption. The publication process blocks on this issue.

Expected behavior (e.g., it shouldn't crash):
We expect with renaming of elements that all optional attributes are considered.

Dominant language
JavaScript
Stars
807
Forks
440
Avg merge
1h 2m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from speced/respec

All issues in speced/respec

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.