Empty HTML anchors and the numbering of items

4 weeks ago 27
ARTICLE AD BOX

Consider the HTML code below:

<HTML> <BODY> <OL> <LI> <A NAME="a"></A> First line of first item <LI> <A NAME="b"></A> First line of second item <P> Second line of second item <LI> <A NAME="c"></A> <P> First line of third item <P> Second line of third item </OL> </BODY> </HTML>

In Firefox and previous versions of Safari it renders as expected:

1. First line of first item 2. First line of second item Second line of second item 3. First line of third item Second line of third item

but in Safari 26.2 and 26.3 it renders like this:

1. First line of first item First line of second item 2. Second line of second item 3. First line of third item Second line of third item

The number of the second item appears in its second line, not in its first line.

The difference between the second and the third items is that the the first of the third item starts with <P>.

It seems to be caused by empty anchors: if I change the second anchor to <A NAME="b">b</A>, then it all renders correctly.

Is my markup correct or is it a bug in Safari?

(This is an MWE. The actual page is https://www.lua.org/bugs.html#5.4.4.)

Read Entire Article