question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SectionOnPage leaving newlines and escaping leading space in HREFs

See original GitHub issue

Summary

Runnig VNU validator I noticed a few complaints for newlines in the generated HREFs. EX:

"file:/mnt/z/mdn-content/build/en-us/docs/web/api/htmlimageelement/loading/index.html":116.7-117.29: error: Bad value “/en-US/docs/Learn/HTML/Howto/Author_fast-loading_HTML_pages#use↩____lazy_loading_for_images” for attribute “href” on element “a”: Tab, new line or carriage return found.

Think the newlines should be stripped when generating the ID values.

URL

https://github.com/mdn/content/blame/217dbcd5126ecdd61ebf0e6993cf37c58f52fa1f/files/en-us/web/api/htmlimageelement/loading/index.md#L124-L125

Reproduction steps

Expected behavior

Should generate:

  <li><a href="/en-US/docs/Learn/HTML/Howto/Author_fast-loading_HTML_pages#use____lazy_loading_for_images">Use
    lazy loading for images</a> in <a href="/en-US/docs/Learn/HTML/Howto/Author_fast-loading_HTML_pages">Tips for authoring fast-loading HTML pages</a></li>

Actual behavior

Generates:

  <li><a href="/en-US/docs/Learn/HTML/Howto/Author_fast-loading_HTML_pages#use
____lazy_loading_for_images">Use
    lazy loading for images</a> in <a href="/en-US/docs/Learn/HTML/Howto/Author_fast-loading_HTML_pages">Tips for authoring fast-loading HTML pages</a></li>

Device

Desktop

Browser

Firefox

Browser version

Stable

Operating system

Windows

Screenshot

No response

Anything else?

The browser ultimately “fixes” this, so it doesn’t fail to render the link

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nschonnicommented, Dec 13, 2022

If this is just being tracked under the regular depreciation, I guess this could just be closed

1reaction
caugnercommented, Dec 9, 2022

It looks like SectionOnPage is still used in mdn/content, which is probably why it’s not marked as deprecated yet.

cc @bsmth

Read more comments on GitHub >

github_iconTop Results From Across the Web

Render a string in HTML and preserve spaces and linebreaks
<div> This is some text with some extra spacing and a few newlines along with some trailing spaces and five leading spaces thrown...
Read more >
UNIX System Services Programming Tools - IBM
If a newline character is found, yylex() increments the count of lines and characters. If a sequence of spaces or tabs is found,...
Read more >
Greenbook Manual (Full) - PGE
space on the property for PG&E to install a dedicated transformer. ... enter from the top without interfering with the utility-provided manual bypass...
Read more >
Removing whitespace from around links? - HTML & CSS
Hi there, Sometimes when I have links on new lines, it is adding a space/whitespace after the link. For example, if I have:...
Read more >
Jinja2 Tutorial - Part 3 - Whitespace control |
You should now clearly see leading spaces that were left by Jinja2 block on three of the lines, as well as all of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found