Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/229659
Change subject: Element: Preserve 'classes' config option through infusion
......................................................................
Element: Preserve 'classes' config option through infusion
Change-Id: Icd05431bedb09d782cb880deb455e52241ca2403
---
M php/Element.php
1 file changed, 13 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/59/229659/1
diff --git a/php/Element.php b/php/Element.php
index 5153bce..c68cb6a 100644
--- a/php/Element.php
+++ b/php/Element.php
@@ -39,6 +39,14 @@
protected $data = null;
/**
+ * CSS classes explicitly configured for this element (as opposed to
#$classes, which contains all
+ * classes for this element).
+ *
+ * @var string[]
+ */
+ protected $ownClasses = array();
+
+ /**
* Mixins.
*
* @var ElementMixin[] List mixed in objects.
@@ -69,7 +77,8 @@
$this->setData( $config['data'] );
}
if ( isset( $config['classes'] ) && is_array(
$config['classes'] ) ) {
- $this->addClasses( $config['classes'] );
+ $this->ownClasses = $config['classes'];
+ $this->addClasses( $this->ownClasses );
}
if ( isset( $config['id'] ) ) {
$this->setAttributes( array( 'id' => $config['id'] ) );
@@ -220,6 +229,9 @@
if ( $this->data !== null ) {
$config['data'] = $this->data;
}
+ if ( $this->classes !== array() ) {
+ $config['classes'] = $this->classes;
+ }
return $config;
}
--
To view, visit https://gerrit.wikimedia.org/r/229659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd05431bedb09d782cb880deb455e52241ca2403
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits