Bug 7143

Summary: REGRESSION: onclick handler cannot call a function named OnClick
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: DOMAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: alice.barraclough, darin
Priority: P1 Keywords: HasReduction, InRadar, Regression
Version: 420+   
Hardware: Macintosh   
OS: OS X 10.4   
Attachments:
Description Flags
test case none

Description Alexey Proskuryakov 2006-02-08 11:53:51 PST
Steps to reproduce: open the attached test case, click on the text.

Expected results: an alert appears.
Actual results: nothing happens.
Comment 1 Alexey Proskuryakov 2006-02-08 11:54:41 PST
Created attachment 6345 [details]
test case

Error message:
Value OnClick(); (result of expression OnClick) is not object.
Comment 2 Darin Adler 2006-02-08 21:03:49 PST
For some reason, we have an onclick property on DOM nodes that allows you to set and get the onclick handle for a DOM node. I can't find any other web browser that has this property.

Because of this property, when you try to call a function on the window object named onclick, you find the property on the DOM node first.

The fix is presumably just to remove the property, but I would like to know why the property is there, and how many of the other "onxxx" properties need to be removed.
Comment 3 Darin Adler 2006-02-08 21:08:22 PST
Removing the properties from kjs_dom.cpp is going to be easy. The only hard thing here is testing with other browsers to see whether they have properties like ours.
Comment 4 Darin Adler 2006-02-12 21:55:43 PST
Maciej thinks my analysis is wrong and this is really about case sensitivity. I think he's right and my tests of other browsers were confused. I'll look into a fix given that insight.
Comment 5 Darin Adler 2006-02-19 09:32:17 PST
I now believe that fixing this is as simple as changing the getAttribute calls in KJS::DOMElement::getOwnPropertySlot and KJS::DOMElement::attributeGetter in kjs_dom.cpp. Either we remove them entirely or we change them to construct a QualifiedName directly to avoid the lower-casing that's done in WebCore::ElementImpl::getAttributeNS.

The argument for removing them entirely is that they implement a feature that is not present in Gecko/Firefox. The argument for keeping them is that they implement a feature that is similar to something present in Internet Explorer.
Comment 6 Alice Liu 2006-03-20 07:10:26 PST
<rdar://problem/4483856>