From 172effbf17c85cd15afb2e1264670b487c030e5a Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 3 Aug 2007 17:40:21 +0000 Subject: [PATCH] (bug 9437) Don't overwrite edit form submission handler when setting up edit box scroll position preserve/restore behaviour --- RELEASE-NOTES | 3 ++- includes/DefaultSettings.php | 2 +- skins/common/wikibits.js | 25 ++++++++++++++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a55bb73782..19f8036390 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -348,7 +348,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN cases. * Fix RTL display of the upload form. * Fixed regression in blocking of username '0' - +* (bug 9437) Don't overwrite edit form submission handler when setting up + edit box scroll position preserve/restore behaviour == API changes since 1.10 == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f802ac07a6..241f63f7ff 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1195,7 +1195,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '95'; +$wgStyleVersion = '96'; # Server-side caching: diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 1e37e3c2fb..454b733b81 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -778,20 +778,23 @@ function toggle_element_check(ida,idb) { document.getElementById(idb).checked=false; } +/** + * Restore the edit box scroll state following a preview operation, + * and set up a form submission handler to remember this state + */ function scrollEditBox() { - var editBoxEl = document.getElementById("wpTextbox1"); - var scrollTopEl = document.getElementById("wpScrolltop"); - var editFormEl = document.getElementById("editform"); - - if (editBoxEl && scrollTopEl) { - if (scrollTopEl.value) { editBoxEl.scrollTop = scrollTopEl.value; } - editFormEl.onsubmit = function() { - document.getElementById("wpScrolltop").value = document.getElementById("wpTextbox1").scrollTop; - }; + var editBox = document.getElementById( 'wpTextbox1' ); + var scrollTop = document.getElementById( 'wpScrolltop' ); + var editForm = document.getElementById( 'editform' ); + if( editBox && scrollTop ) { + if( scrollTop.value ) + editBox.scrollTop = scrollTop.value; + addHandler( editForm, 'submit', function() { + document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; + } ); } } - -hookEvent("load", scrollEditBox); +hookEvent( 'load', scrollEditBox ); var allmessages_nodelist = false; var allmessages_modified = false; -- 2.20.1