Menu

#74 Nesting rules for A have changed in HTML 5

Unstable (example)
open
nobody
html5 (1)
5
2020-09-01
2018-06-16
fluffy
No

I recently rebuilt my website in HTML5 and in doing so discovered a fun little issue with how w3m nests elements inside links.

In HTML5 there is now the allowance for what were previously considered block-level elements to nest inside what were previously considered inline elements, since the specification now completely separates presentation from markup. The end result of this is that with code like:

<a href=“http://example.com/“><div>some text</div></a>

the “some text” text does not behave as a link in w3m, despite it being a clickable target in most browsers (and validating correctly on the HTML5 validator at validator.w3.org).

I replicated this bug on the latest version of w3m built via homebrew on macOS:

$ w3m -version
w3m version w3m/0.5.3+git20180125, options lang=en,m17n,color,ansi-color,mouse,menu,cookie,ssl,ssl-verify,external-uri-loader,w3mmailer,nntp,ipv6,alarm,mark

I have changed my nested elements to be instead of

(since it looks nicer in lynx and w3m anyway) but this is probably something that should be fixed in order to maintain compatibility with the latest web standards.

Discussion

  • fluffy

    fluffy - 2018-06-18

    I have changed my nested elements to be instead of
    (since it looks nicer in lynx and w3m anyway) but this is probably something that should be fixed in order to maintain compatibility with the latest web standards.

    This text should have read:

    I have changed my nested elements to be <span> instead of <div>

    but apparently sourceforge doesn't sanitize their HTML and also doesn't provide a means of editing a ticket description. Oops.

     
  • Tatsuya Kinoshita

    In Debian's w3m Git repo, w3m now supports links containing divs for HTML5.

     

Log in to post a comment.