xhtml - Undefined behaviour in (X)HTML? -
i know question pretty asking downvotes, but...
is there such thing undefined behaviour in (x)html?
i have wondered after playing around <button>
tag, allows html rendered button. nothing new far...
but noticed 1 can use <a>
tag. complete example:
<button> normal text <b>bold text</b> <a href="http://www.example.com/">linked text</a> </button>
this rendered following on firefox:
http://img6.imagebanana.com/img/aq10duov/selection_005.png
and in google chrome:
http://img6.imagebanana.com/img/vdlak82n/selection_008.png
now, on firefox, link target not clickable, button... however, on chrome, link clickable, , redirect iana rfc2606 page.
is undefined behaviour? there more cases in (x)html described undefined behaviour?
it's little more complex inspecting dtd given yi jiang , mu short.
it's true xhtml 1.0 dtds explicitly forbid <a>
elements children of <button>
elements given in question. not forbid <a>
elements descendants of <button>
elements.
so
<button> normal text <b>bold text</b> <span><a href="http://www.example.com/">linked text</a></span> </button>
is xhtml 1.0 strict dtd conforming. has same behavioural difference between firefox , chrome button fragment in question.
now, known dtds have problems describing limitations on descendant relationships, it's maybe not surprising above sample dtd conforming.
however. appendix b of xhtml 1.0 spec normatively describes descendant limitations in addition dtd. says:
the following elements have prohibitions on elements can contain (see sgml exclusions). prohibition applies depths of nesting, i.e. contains descendant elements.
button
must not contain input, select, textarea, label, button, form, fieldset, iframe or isindex elements.
note not contain exclusion <a>
element. seems xhtml 1.0 not prohibit <a>
element being non-child descendant of <button>
, behaviour in case indeed undefined.
this omission mistake. <a>
element should have been in list of elements prohibited descendants of button in appendix b.
html5 (including xhtml5) more thorough on matter. says:
4.10.8 button element
content model: phrasing content, there must no interactive content descendant.
where interactive content defined
interactive content content intended user interaction.
a
audio
(ifcontrols
attribute present)button
details
embed
iframe
img
(ifusemap
attribute present)input
(iftype
attribute not inhidden
state)keygen
label
menu
(iftype
attribute intoolbar
state)object
(ifusemap
attribute present)select
textarea
video
(ifcontrols
attribute present)
so in (x)html5 <a>
element is prohibited being descendant of <button>
element.
Comments
Post a Comment