Closed Bug 1597063 Opened 6 years ago Closed 6 years ago

empty/self-closed format tag is still applied to block

Categories

(Core :: DOM: Core & HTML, defect)

70 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: dwade, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

put a self-closed format tag (i.e. <b/> or <i/>) in front of text and it still applies to the block. This was output from an xslt/xml -> html process (no text in the tag, so xsl simplified it to a self-closed tag).

Actual results:

example: <b/>this is a test
is bolded

example: <b></b>this is a test
is not bolded

Expected results:

Because it's a self-closed tag, I expected it to not apply formatting. I realize the HTML standard is loose on open/close of formatting tags, but because it is a closed tag I wouldn't expect it to be applied.

Component: Untriaged → Layout
Product: Firefox → Core

I don't think you can self-close those tags in HTML.

This is an HTML parser thing, but it is interoperable across browsers so I'm pretty sure it is invalid.

Component: Layout → DOM: Core & HTML

Not a bug, see: https://html.spec.whatwg.org/multipage/syntax.html#start-tags:

"Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing."

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID

In HTML, the LINK and META tags, for example, are self-closing.

These are considered VOID elements, so the self-closing slash is ignored.

Although in both the 3.2 and 5.3 W3C HTML Standard documents deem for text format tags, both open & close tags are not omissible.
An exception case is if an unclosed format tag is within a table, it doesn't continue outside the cell.

You need to log in before you can comment on or make changes to this bug.