简体   繁体   English

从form.elements中排除input [type ='image']的历史原因是什么?

[英]What are the historical reasons for excluding input[type='image'] from form.elements

Regarding HTML spec for form.elements there is a note on listed elements "excluding image buttons for historical reasons" 关于form.elements的 HTML规范 ,在列出的元素上有一条注释“出于历史原因不包括图像按钮”

I can't seem to find what the historical reasons are. 我似乎找不到历史原因。

This is for compatibility with the DOM as implemented by Netscape and early versions of IE, aka "DOM level 0", in which image buttons were not considered form elements (despite clearly being input elements that the user could interact with) and therefore excluded from most form functionality. 这是为了与Netscape和IE早期版本(也称为“ DOM级别0”)实现的DOM兼容,在这些版本中,图像按钮不被视为表单元素(尽管显然是用户可以与之交互的input元素),因此不包含在其中。大多数表单功能。 See this Bugzilla report . 请参阅此Bugzilla报告

In particular, in Netscape 4 their behavior was much more like that of regular image links ( <a href="..."><img src="..."></a> ) than in IE, such as adding a border similar to that of image links and not supporting event handlers at all, although IE had its own share of quirks as well especially when they were used as submit buttons. 特别是,在Netscape 4中,它们的行为更像是常规图像链接( <a href="..."><img src="..."></a> ),而不是IE中的行为,例如添加尽管IE也有自己的独特之处,但特别是当它们用作提交按钮时,它的边框与图像链接的边框类似,并且根本不支持事件处理程序。 In general, image buttons have always been a mess, much of which stemmed from being largely underspecified prior to HTML 4 (and, frankly, even then). 通常,图像按钮一直都是一团糟,其中很大一部分是由于在HTML 4之前(以及坦率地说,甚至在那时)还没有充分指定。 See Jukka K. Korpela's and Alan J. Flavell's write-ups on the subject. 参见Jukka K. KorpelaAlan J. Flavell关于该主题的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM