r61070 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61069‎ | r61070 | r61071 >
Date:00:55, 15 January 2010
Author:simetrical
Status:ok
Tags:
Comment:
Remove OutputPage::{get,set}OnloadHandler()

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.
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -1684,12 +1684,6 @@
16851685 $classes[] = $attribs['class'];
16861686 $attribs['class'] = implode( ' ', $classes );
16871687 }
1688 -
1689 - # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
1690 - if ( !$this->preview && !$this->diff ) {
1691 - global $wgOut;
1692 - $wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus();' );
1693 - }
16941688
16951689 $this->showTextbox( isset($textoverride) ? $textoverride : $this->textbox1, 'wpTextbox1', $attribs );
16961690 }
Index: trunk/phase3/includes/OutputPage.php
@@ -21,7 +21,6 @@
2222
2323 var $mAllowUserJs;
2424 var $mSuppressQuickbar = false;
25 - var $mOnloadHandler = '';
2625 var $mDoNothing = false;
2726 var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
2827 var $mIsArticleRelated = true;
@@ -388,8 +387,6 @@
389388 public function setPrintable() { $this->mPrintable = true; }
390389 public function isPrintable() { return $this->mPrintable; }
391390 public function getFeedAppendQuery() { return $this->mFeedLinksAppendQuery; }
392 - public function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; }
393 - public function getOnloadHandler() { return $this->mOnloadHandler; }
394391 public function disable() { $this->mDoNothing = true; }
395392 public function isDisabled() { return $this->mDoNothing; }
396393
Index: trunk/phase3/includes/Skin.php
@@ -672,7 +672,6 @@
673673 $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
674674 $a += array( 'ondblclick' => $s );
675675 }
676 - $a['onload'] = $wgOut->getOnloadHandler();
677676 $a['class'] =
678677 'mediawiki' .
679678 ' '.( $wgContLang->getDir() ).
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php
@@ -637,11 +637,6 @@
638638 $subjectpreview = '';
639639 }
640640
641 - # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
642 - /*if( !$this->preview && !$this->diff ) {
643 - $wgOut->setOnloadHandler( 'document.editform.wpTextbox1.focus()' );
644 - }*/
645 -
646641 $templates = ( $this->preview || $this->section != '' ) ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates();
647642 $formattedtemplates = $sk->formatTemplates( $templates, $this->preview, $this->section != '' );
648643

Status & tagging log