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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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