jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350088 )

Change subject: Fix invalid state error
......................................................................


Fix invalid state error

MobileFormatter::makeSections() was modifying the DOM structure
and because of that MobileFormatter::makeHeadingsEditable() was failing
as subheadings were rearranged (wrapped into different containers).

MobileFormatter::makeHeadingsEditable() doesn't change the DOM structure
so flipping those two calls solved the problem. First we add classes to
existing elements, then we change the DOM.

Bug: T151838
Change-Id: I750bcefc63c11164b5eb5f9c6c1a209355d8dbab
---
M includes/MobileFormatter.php
1 file changed, 1 insertion(+), 2 deletions(-)

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



diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index 2171d3d..fd772f1 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -174,8 +174,8 @@
                // Sectionify the content and transform it if necessary per 
section
                if ( !$this->mainPage && $this->expandableSections ) {
                        list( $headings, $subheadings ) = $this->getHeadings( 
$doc );
-                       $this->makeSections( $doc, $headings, $transformOptions 
);
                        $this->makeHeadingsEditable( $subheadings );
+                       $this->makeSections( $doc, $headings, $transformOptions 
);
                } else {
                        // Otherwise apply the per-section transformations to 
the document as a whole
                        $this->filterContentInSection( $doc, $doc, 0, 
$transformOptions );
@@ -688,7 +688,6 @@
        protected function makeHeadingsEditable( array $headings ) {
                foreach ( $headings as $heading ) {
                        $class = $heading->getAttribute( 'class' );
-
                        if ( strpos( $class, 'in-block' ) === false ) {
                                $heading->setAttribute(
                                        'class',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I750bcefc63c11164b5eb5f9c6c1a209355d8dbab
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Pmiazga <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to