Remove OutputPage::{get,set}OnloadHandler()
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 15 Jan 2010 00:55:51 +0000 (00:55 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 15 Jan 2010 00:55:51 +0000 (00:55 +0000)
Didn't work at all in Monobook, Modern, Vector, or any derived skin, for
who knows how long.  Only one caller, which was using it to autofocus,
which is a bad idea anyway because it will cause the focus to happen too
late, often after the user has already interacted with the page.  Any
legitimate callers may as well just add the onload in pure JS without
adding an attribute to the body.

includes/EditPage.php
includes/OutputPage.php
includes/Skin.php

index bb325b8..db2935e 100644 (file)
@@ -1684,12 +1684,6 @@ INPUTS
                                $classes[] = $attribs['class'];
                        $attribs['class'] = implode( ' ', $classes );
                }
-
-               # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
-               if ( !$this->preview && !$this->diff ) {
-                       global $wgOut;
-                       $wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus();' );
-               }
                
                $this->showTextbox( isset($textoverride) ? $textoverride : $this->textbox1, 'wpTextbox1', $attribs );
        }
index 6b2a97d..8bd6906 100644 (file)
@@ -21,7 +21,6 @@ class OutputPage {
 
        var $mAllowUserJs;
        var $mSuppressQuickbar = false;
-       var $mOnloadHandler = '';
        var $mDoNothing = false;
        var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
        var $mIsArticleRelated = true;
@@ -388,8 +387,6 @@ class OutputPage {
        public function setPrintable() { $this->mPrintable = true; }
        public function isPrintable() { return $this->mPrintable; }
        public function getFeedAppendQuery() { return $this->mFeedLinksAppendQuery; }
-       public function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; }
-       public function getOnloadHandler() { return $this->mOnloadHandler; }
        public function disable() { $this->mDoNothing = true; }
        public function isDisabled() { return $this->mDoNothing; }
 
index ced9b16..9cc94f4 100644 (file)
@@ -672,7 +672,6 @@ CSS;
                        $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
                        $a += array( 'ondblclick' => $s );
                }
-               $a['onload'] = $wgOut->getOnloadHandler();
                $a['class'] =
                        'mediawiki' .
                        ' '.( $wgContLang->getDir() ).