jenkins-bot has submitted this change and it was merged.

Change subject: Element: Preserve 'classes' config option through infusion
......................................................................


Element: Preserve 'classes' config option through infusion

Bug: T104301
Change-Id: Icd05431bedb09d782cb880deb455e52241ca2403
---
M php/Element.php
1 file changed, 13 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/php/Element.php b/php/Element.php
index 5153bce..601f2b8 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->ownClasses !== array() ) {
+                       $config['classes'] = $this->ownClasses;
+               }
                return $config;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/229659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd05431bedb09d782cb880deb455e52241ca2403
Gerrit-PatchSet: 3
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to