Open aaronpk opened 4 years ago
Same applies to <img src=
, <video src=
, …
(Originally published at: https://www.svenknebel.de/posts/2020/3/2/)
Related discussion about what the mf2 spec means by "normalized": https://github.com/microformats/microformats2-parsing/issues/9
I'm +1 for trimming the whitespace, though the spec change might need to be in the last bullet point ("return the normalized absolute URL...") to ensure it applies to all cases.
+1 from me. I don't recall what the Go library does in this regard, but I'm happy to update it to match this spec change.
+1 to @gRegorLove's note. I think the last bullet in the "parsing a u-*
property" should be updated:
return the normalized absolute URL of the gotten value, following the containing document's language's rules for resolving relative URLs (e.g. in HTML, use the current URL context as determined by the page, and first
<base>
element, if any).
…and/or whitespace stripping is implied in the existing text? I'd rather we be explicit, though.
There is currently an inconsistency in the PHP, Ruby and Python parsers regarding spaces in
u-*
values. The PHP and Ruby parsers will remove surrounding spaces from the value returned inu-*
properties, but the Python parser does not.Given this HTML:
PHP:
Ruby
Python
The HTML spec says:
Since the Microformats parser is trying to return a URL value, it seems like removing the spaces is the correct behavior, even though that is not currently in the Microformats spec, which just says:
http://microformats.org/wiki/microformats2-parsing#parsing_a_u-_property
I would like to propose a spec change to make it explicit that the parser should remove any surrounding spaces from the
href
attribute.