Bug 16997

Summary: Support IE way of creating event handlers (function document.onkeydown() {})
Product: WebKit Reporter: Rui Jiang <rjiang>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: barraclough, eric
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: https://ibsbjstar.ccb.com.cn/V5/js5/mainPage.js
Attachments:
Description Flags
test case none

Description Rui Jiang 2008-01-24 15:28:17 PST
As a reduced test case: 

<html><head></head><body>
<h1>IE event syntax</h1>
<b>Press any key now</b>
<script>
function document.onkeydown() { alert("Key Down!"); }

alert("It works!");
</script>
</body></html>

To repro, save the above content to an html file, open it, and press any key. IE works and will show an alert. FF, WebKit don't.

IE supports a way to create event handlers like:

function document.onkeydown() { alert("Key Down!"); }

JavaScriptCore does not recognize it and it will stop processing after seeing the syntax above.

We should support it if possible, it's being used in a lot of websites. The one I saw this happening is at http://www.ccb.com, top 3 bank in China. After login, one js file (https://ibsbjstar.ccb.com.cn/V5/js5/mainPage.js) contains above syntax which prevented it from being usable.
Comment 1 Alexey Proskuryakov 2008-01-25 00:04:02 PST
Created attachment 18688 [details]
test case

Same test, as an attachment.
Comment 2 Gavin Barraclough 2011-07-21 22:51:56 PDT
These are not on track for standardization, Firefox don't support these, and I think neither Chrome nor Opera do either?  Without interest from ECMA or wider browser support I don't think we'll want to adopt further proprietary and non-standard mechanisms, without a good reason.

A good reasons to reopen this bug would be ECMA adoption, wider de-facto support, or a major web compatibility issue.
Comment 3 Gavin Barraclough 2011-08-09 11:56:21 PDT
*** Bug 18531 has been marked as a duplicate of this bug. ***