W3C home > Mailing lists > Public > public-html@w3.org > November 2008

Re: [WF2] HTMLFormElement.accept vs. function accept(){}

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 5 Nov 2008 17:54:06 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: public-html <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0811051753590.1237@hixie.dreamhostps.com>

On Wed, 20 Feb 2008, Simon Pieters wrote:
> 
> HTML4 has a <form accept> attribute but DOM2 HTML doesn't have a corresponding
> HTMLFormElement.accept attribute. WF2 fixes this bug and includes
> HTMLFormElement.accept. However, this has caused problems for us since some
> sites depend on it not being supported by having a function called accept()
> and call that in event handler attributes on the form, like so:
> 
>    <script> function accept() { ... } </script>
>    <form onsubmit="accept()"> ...
> 
> In Opera, accept refers to the DOM attribute instead of the function,
> resulting in a TypeError exception. This is because DOM attributes take
> predecense over functions -- compare with e.g. "method" in other browsers:
> 
>    http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cscript%3E%20function%20method()%20{%20alert(1)%20}%20%3C%2Fscript%3E%3Cform%20onsubmit%3D%27try%20{%20method()%3B%20}%20catch(e)%20{%20w(e)%20}%20return%20false%27%3E%3Cinput%20type%3Dsubmit%3E%3Cscript%3E%20document.forms[0].firstChild.click()%20%3C%2Fscript%3E
> 
> There are some ways to fix this problem.
> 
>   1) Make the .accept DOM attribute not override functions in scope.
>   2) Remove support for .accept DOM attribute but keep the content attribute.
>   3) Remove support for both .accept and <form accept>.
> 
> (1) is hairy. (2) is in line with HTML4/DOM2 HTML, but is inconsistent. I
> don't see any problems with (3). <form accept> is only "fallback" for <input
> type=file accept> anyway, so, not very useful, and besides it's not really
> used in the wild.
> 
> So I'd suggest that the <form accept> attribute be removed from WF2.

Done.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 5 November 2008 17:54:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:24 GMT