Re: Nu-HTML checker - <details> as child of <figure>?
"Michael[tm] Smith" <[email protected]> Tue, 2 Jun 2020 09:48:11 +0900
| Newsgroups | gmane.org.w3c.validator |
|---|---|
| Message-ID | <[email protected]> |
--IKC1RK7+nRZ8SZaO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable For the figure element, the HTML defines the following content model: https://html.spec.whatwg.org/multipage/#the-figure-element:concept-element-= content-model > Either: one figcaption element followed by flow content. > Or: flow content followed by one figcaption element. > Or: flow content. So an example of a non-conforming case would be something like this: <figure> <img src=3Dfoo alt=3Dbar> <figcaption>...</figcaption> <details><summary>...</summary></details> </figure> That example would cause the checker to report an "Element =E2=80=9Cdetails= =E2=80=9D not allowed as child of element =E2=80=9Cfigure=E2=80=9D in this context" error. Specifically, the spec requirements don=E2=80=99t allow content both before= and after the figcaption element =E2=80=94 either the figcaption must be the fi= rst child of the figure, or it must be the last child. But both of the following would be conforming, and would not cause the checker to report any error. <figure> <figcaption>...</figcaption> <img src=3Dfoo alt=3Dbar> <details><summary>...</summary></details> </figure> <figure> <img src=3Dfoo alt=3Dbar> <details><summary>...</summary></details> <figcaption>...</figcaption> </figure> Joseph Polizzotto MA <[email protected]>, 2020-06-01 16:34 -0700: > Archived-At: <https://www.w3.org/mid/CAGQNLEUAvA_hYSGV9A8mCMhY9wb-9b_n_n3= [email protected]> >=20 > I would like to use <details> as a child of <figure> but get an error > message when running the Nu-HTML checker. >=20 > error: Element =E2=80=9Cdetails=E2=80=9D not allowed as child of element = =E2=80=9Cfigure=E2=80=9D in this > context. (Suppressing further errors from this subtree.) >=20 > I believe my use of <details> as a child of <figure> is flagged because I > am also using <figcaption> within the same <figure>. When <details> is a > child of <figcaption> within the <figure>, the error goes away. >=20 > I also noticed that when I use <details> as a child of <figure> that does > not have <figcaption>, there is no error. >=20 > I am wondering why the Nu_HTML validator allows <details>1) as a child of > <figcaption> and 2) as a child of <figure> when there is no <figcaption>, > but not 3) as a child of <figure>, which also has <figcaption>. >=20 > Note: I have tested <details> as a child of <figure> with a <figcaption> > with Firefox, Chrome, and Edge and noticed that these browsers do support > this combination. >=20 > Thanks for your help, >=20 > Joseph >=20 --=20 Michael[tm] Smith https://people.w3.org/mike --IKC1RK7+nRZ8SZaO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE1IdYVkFeY5ZNh0RRh9F0d7w6S5UFAl7VoccACgkQh9F0d7w6 S5WZIw//fsCad1XYhlYPmkStmt1X6wPUg+sTqsdjhau0C/tG+1cNDJ9DXGxL0poX HW3dxWRmL0EQOxZ3wPlY7lyx+MPpv0tFcvpP+NpGwBfe8264pJMbGh+xVA2IOpij LL32ZVBnSDkM9jLoLni64DcdAgHwRL6eM+Zso22kRzDMId4u7gtUeLx8705JGkZY EJDdSFjYE5o4F5CVeDA6QHUBEDrFH80a+NLFaOqegy+WqfiA7JB9ADsgb90WU3rd fFJy1TZaGM+k90vVtc+LismrIWORDN6kPqcgrVzvmfK5QgZ7c1SDxmo9gJ1sKPNs aDvrOd/xrHbJ1NfvBa74OP4tVPJyvzV9PaSzZqDBnjAf4wemsm4FKa7sCxIX9wPn JgNVl1Ny+gqiv5eHWKMmEqTqom3WXHinK+td/vA6MEMO7knS0zkmrgUyRqYDKPwF HNuT4/meXhJLe6CG3mSgs83bhQywbpGxjNdDwYphE/Ub6kJfvKm+rcK0fMquWJ1x ySBkaytcXuEPCDE6CuASaqQUXPALFfDsQNA7SVN/kyW9tfFOW3lAfsYU97Nz4HJm 4EwriPWzTe0H06yviViVnKcrB+dQrZpqVHr4A49c/SALfN6dqGatJo1HbjF3G8Tr IoWupfADgQkTLMtcnU9OuLZm4B7bfqhclNfhG9UFQiKdqTGpLtk= =h3Q4 -----END PGP SIGNATURE----- --IKC1RK7+nRZ8SZaO--