jenkins-bot has submitted this change and it was merged.
Change subject: [BREAKING CHANGE] ButtonWidget: Don't default 'target' to
'_blank'
......................................................................
[BREAKING CHANGE] ButtonWidget: Don't default 'target' to '_blank'
target=_blank has its use cases, but it definitely shouldn't be the
default behavior.
Bug: T75452
Change-Id: I88b7bc1b562bca2a63b611b1d33dd9d534297e68
---
M demos/widgets.php
M php/widgets/ButtonWidget.php
M src/widgets/ButtonWidget.js
3 files changed, 2 insertions(+), 7 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/demos/widgets.php b/demos/widgets.php
index 305d7c7..1217289 100644
--- a/demos/widgets.php
+++ b/demos/widgets.php
@@ -31,12 +31,10 @@
new OOUI\ButtonWidget( array(
'label' => 'LTR',
'href' => '?dir=ltr',
- 'target' => null,
) ),
new OOUI\ButtonWidget( array(
'label' => 'RTL',
'href' => '?dir=rtl',
- 'target' => null,
) ),
)
) );
diff --git a/php/widgets/ButtonWidget.php b/php/widgets/ButtonWidget.php
index 0464ed2..1dff2bb 100644
--- a/php/widgets/ButtonWidget.php
+++ b/php/widgets/ButtonWidget.php
@@ -27,9 +27,6 @@
* @param string $config['target'] Target to open hyperlink in
*/
public function __construct( array $config = array() ) {
- // Configuration initialization
- $config = array_merge( array( 'target' => '_blank' ), $config );
-
// Parent constructor
parent::__construct( $config );
@@ -49,7 +46,7 @@
->appendContent( $this->button );
$this->setHref( isset( $config['href'] ) ? $config['href'] :
null );
- $this->setTarget( $config['target'] );
+ $this->setTarget( isset( $config['target'] ) ?
$config['target'] : null );
}
/**
diff --git a/src/widgets/ButtonWidget.js b/src/widgets/ButtonWidget.js
index 17ac0ee..a2484f2 100644
--- a/src/widgets/ButtonWidget.js
+++ b/src/widgets/ButtonWidget.js
@@ -17,7 +17,7 @@
*/
OO.ui.ButtonWidget = function OoUiButtonWidget( config ) {
// Configuration initialization
- config = $.extend( { target: '_blank' }, config );
+ config = config || {};
// Parent constructor
OO.ui.ButtonWidget.super.call( this, config );
--
To view, visit https://gerrit.wikimedia.org/r/176488
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I88b7bc1b562bca2a63b611b1d33dd9d534297e68
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits