Skip to content

response.bodyUsed: Fix bad URL, update syntax #40337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 13, 2025
Merged

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Jul 13, 2025

Replace bad image URL:

  • The URL used in the example (an image on a Mediawiki server) was no longer valid. For future-proofing, seems better to use a local image URL.
  • Add width=150 to <img> tag, because the new image is an SVG that will otherwise render overpoweringly large. Update code:
  • Remove the trailing / in the <img> tag, because we're writing HTML not XML. (Linter decided it likes <img ... />.)
  • Replace the non-conforming use of <br /> to separate thematic elements with enclosing <p> tags around each thematic element.
  • Replace arbitrary, gratuitous use of <pre> with <p> tags.

Description

The URL used in the example (an image on a Mediawiki server) was no longer valid. Also, the code was... quite outdated, by current web standards.

Motivation

Examples are more effective when they successfully demonstrate the features being documented, which a broken image placeholder doesn't really accomplish. Ditto, code that demonstrates recent web standards and practices, rather than flaunting them.

Additional details

Related issues and pull requests

Replace bad image URL:
- The URL used in the example (an image on a Mediawiki
  server) was no longer valid. For future-proofing, seems
  better to use a local image URL.
- Add width=200 to `<img>` tag, because the new image is
  an SVG that will otherwise render overpoweringly large.
Update code:
- Remove the trailing / in the `<img>` tag, because we're
  writing HTML not XML.
- Replace the non-conforming use of `<br />` to separate
  thematic elements with enclosing `<p>` tags around each
  thematic element.
- Replace arbitrary, gratuitous use of `<pre>` with `<p>` tags.
@ferdnyc ferdnyc requested a review from a team as a code owner July 13, 2025 08:00
@ferdnyc ferdnyc requested review from wbamberg and removed request for a team July 13, 2025 08:00
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Jul 13, 2025
@ferdnyc ferdnyc changed the title response.bodyused: Fix bad URL, update syntax response.bodyUsed: Fix bad URL, update syntax Jul 13, 2025
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

github-actions bot commented Jul 13, 2025

Preview URLs

(comment last updated: 2025-07-13 09:41:19)

Further reduce the image width to 150,  so that the example
doesn't exceed the embedded content area even when all
elements are visible. (With width=200, the text added below
the image on subsequent clicks would extend slightly past the
bottom of the container.)
@ferdnyc ferdnyc requested a review from Josh-Cena July 13, 2025 09:41
Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, and great fix :) Thank you!

@Josh-Cena Josh-Cena merged commit 77fd649 into mdn:main Jul 13, 2025
8 checks passed
@ferdnyc ferdnyc deleted the patch-1 branch July 13, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants