Last modified: 2010-05-15 15:48:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11437, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9437 - wikibits.js: scrollEditBox overwrites onsubmit, should use hookEvent method
wikibits.js: scrollEditBox overwrites onsubmit, should use hookEvent method
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.9.x
PC Windows Server 2003
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-28 17:44 UTC by Dan Barrett
Modified: 2010-05-15 15:48 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dan Barrett 2007-03-28 17:44:17 UTC
In skins/common/wikibits.js, function scrollEditBox is setting the form's
onsubmit handler directly, overwriting any other onsubmit handlers. Therefore
it's not possible for an extension to add an onsubmit handler to EditPage.php.

I suggest scrollEditBox should use wikibits.js:hookEvent() instead of setting
form.onsubmit directly.

The code:
editFormEl.onsubmit = function() {
...
Comment 1 Dan Barrett 2007-03-28 18:01:28 UTC
hookEvent() can't be used directly because it adds events only to the window
object.  So I suggest wikibits.js get a new, more general function,
hookObjectEvent, that works on any object, and you rewrite hookEvent in terms of it.

 // wikibits.js
 function hookObjectEvent(obj, hookName, hookFunct) {
   if (obj.addEventListener) {
     obj.addEventListener(hookName, hookFunct, false);
   } else if (obj.attachEvent) {
     obj.attachEvent("on" + hookName, hookFunct);
   }
 }

 function hookEvent(hookName, hookFunct) {
   hookObjectEvent(window, hookName, hookFunct);
 }
Comment 2 Dan Barrett 2007-08-02 20:06:00 UTC
This is a very simple fix and I've provided full source code for it. Any chance that someone will consider it?  It does not affect MediaWiki's behavior at all, but allows extension writers to add onsubmit handlers properly.


Comment 3 Rob Church 2007-08-03 17:40:50 UTC
Fixed in r24565.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links