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

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

From: Simon Pieters <simonp@opera.com>
Date: Wed, 20 Feb 2008 18:07:17 +0100
To: public-html <public-html@w3.org>
Message-ID: <op.t6t1uffeidj3kv@hp-a0a83fcd39d2.belkin>

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:


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  
   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.

Simon Pieters
Opera Software
Received on Wednesday, 20 February 2008 17:07:34 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:26 UTC