Alternative fix for <frame onload>

David Faure faure at kde.org
Tue Oct 5 21:14:42 CEST 2004


On Tuesday 05 October 2004 15:27, David Faure wrote:
> On Tuesday 05 October 2004 11:16, David Faure wrote:
> > Can I convince you to apply my fix for the problem instead of the
> > dispatchWindowEvent hack?
> 
> In fact I can't :) Dirk pointed out that my patch might do a few things wrong,
> and indeed it does, compared to Mozilla.
> 
> It appears that setting the listener on the frame's document is wrong, at least
> compared to Mozilla, since the following testcase doesn't trigger the frame's
> "document.onload".

The attached patch (based on Safari's) fixes it. Differences with Safari: 
* I left the domain stuff in HTMLDocumentImpl for now (Dirk, should I move it to DocumentImpl?)
* The code emitting load_event for the frame is in HTMLDocumentImpl::close().
This ensures that only the frame's onload event is triggered.
From what I can see, Safari's code makes "document.onload=foo" in the frame's HTML
trigger foo() (since the document's onload is also fired), and Mozilla doesn't do that.
(testcase attached)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: onloadfix.diff
Type: text/x-diff
Size: 7086 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/khtml-devel/attachments/20041005/03c36d44/onloadfix.bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/khtml-devel/attachments/20041005/03c36d44/frame.onload.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/khtml-devel/attachments/20041005/03c36d44/onload_helper.html


More information about the Khtml-devel mailing list