[PATCH] tracking form value changes in onclick-handlers
Tobias Anton
TA at ESC-Electronics.de
Mon Jul 12 20:52:30 BST 2004
Hi,
The attached patch introduces a variable that tracks changes caused by
javascript during event handling. It basically prevents a form value that was
set by a js event listener from being overwritten by accident in the default
event handler.
This would enable us to complete our DOM events model and implement event
listeners that can cancel "click" and "DOMActivate" events.
At the moment, event listeners of the form
function clickEventListener(evt)
{
evt->preventDefault()
}
cannot prevent the default action of form controls (toggling a checkbox,
checking a radiobutton) because the default action, which should be done at
the end of the DOMActivate-event, already has happened long before, during
the mouseup_event.
To fix that, we'd have reorder the event flow to react on ACTIVATE_EVENTS, as
defined by the HTML spec.
But we can't do this without this proposed patch, because current HTML would
fail on DOM Level 0-compliant sites that use code like:
<INPUT TYPE="checkbox" ONCLICK="this.checked=true">
They expect the state of this checkbox to be always checked after its first
activation.
I'm planning to commit a patch like this one, and then I'd like to change the
default event handlers of activatable elements (links, form controls and
labels) to react on DOMACTIVATE_EVENT instead of CLICK_EVENT, or event worse,
MOUSEUP_EVENTS.
Is there anything basically wrong or can I try this approach?
Cheers
-- Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp.diff
Type: text/x-diff
Size: 3364 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20040712/cb57881b/attachment.diff>
More information about the kfm-devel
mailing list