Pmiazga has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350088 )

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

Fix invalid state error

MobileFormatter::makeSections() was modyfinng the DOM structure,
and because of that makeHeadingsEditable() was failing as subheadings
were rearranged (wrapped into different containers). Because
makeHeadingsEditable() doesn't change the DOM structure flipping
those two calls solved the problem

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/88/350088/1

diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index 2171d3d..61d4cfd 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -174,8 +174,10 @@
                // 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 +690,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: newchange
Gerrit-Change-Id: I750bcefc63c11164b5eb5f9c6c1a209355d8dbab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Pmiazga <[email protected]>

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

Reply via email to