You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Empty link, image, definition titles should output title="" on a, img #192
I believe commonmark.js should output title="" if an empty title is defined in Markdown ("", '', ()). This might also be clarified in the spec with examples.
EDIT: Is this a theoretical question, or are there cases where it genuinely matters whether an empty title attribute is used or the title attribute is simply omitted?
It is rather meaningless, in HTML. Although there is a difference:
If this attribute is omitted from an element, then it implies that the title attribute of the nearest ancestor HTML element with a title attribute set is also relevant to this element. Setting the attribute overrides this, explicitly stating that the advisory information of any ancestors is not relevant to this element. Setting the attribute to the empty string indicates that the element has no advisory information.
— https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute
Hence, say there is an image in a link. If the link has a title, then the image will inherit that description. If the image has an empty title attribute, it would be removed explicitly.
Other cases would be if a title was set explicitly in wrapping HTML and then title explicitly set to empty in nested images / links.
As there is a clear difference between [](<>) and [](<> ""), I think it makes sense to support the difference between the two.
Background: I was recently looking at “empty” attributes. Other cases are:
Activity
jgm commentedon Jul 27, 2020
EDIT: Is this a theoretical question, or are there cases where it genuinely matters whether an empty title attribute is used or the title attribute is simply omitted?
wooorm commentedon Jul 27, 2020
It is rather meaningless, in HTML. Although there is a difference:
Hence, say there is an image in a link. If the link has a title, then the image will inherit that description. If the image has an empty title attribute, it would be removed explicitly.
Other cases would be if a
titlewas set explicitly in wrapping HTML and thentitleexplicitly set to empty in nested images / links.As there is a clear difference between
[](<>)and[](<> ""), I think it makes sense to support the difference between the two.Background: I was recently looking at “empty” attributes. Other cases are:
All produce a
href=""orsrc=""respectively. There is also a difference between anawithouthref, and one with: w/o href, the link is a placeholder (the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents). Whereas anaw/href=""means a link to the current document.imgelements are required to havesrcattributes.The two images also produce
alt="". I think this is the correct way to go: omittingaltmeans the user forgot to addalttext.alt=""means the image explicitly has no alt text. As markdown cannot differentiate between the two,alt=""makes the most sense.