Restore the button's active state each time the page is shown while it exists in the DOM.
199233
@UiChild(limit = 1, tagname = "buttonActivePersist")
    public void addActivePersist(final JQMButton button) {
        if (button == null) return;
        addActive(button);
        button.getElement().addClassName("ui-state-persist");
    }
1017857
function restoreState( $pageEnd = 0 )
    {
        if ( !$pageEnd )
        {
            $n = $this->nStateStack;
            $this->currentColour = $this->stateStack[$n]['col'];
            $this->currentStrokeColour = $this->stateStack[$n]['str'];
            $this->objects[$this->currentContents]['c'] .= "\n".$this->stateStack[$n]['lin'];
            $this->currentLineStyle = $this->stateStack[$n]['lin'];
            unset( $this->stateStack[$n] );
            $this->nStateStack--;
        }
        $this->objects[$this->currentContents]['c'] .= "\nQ";
    }
624062
void onRadioToggle(int index) {
        for (int i = 0; i < getChildCount(); i++) {

            if (i != index) {
                BootstrapButton b = retrieveButtonChild(i);
                b.setSelected(false);
            }
        }
    }
441131
def OnButtonCell(self, event):
        """"""

        # The button text
        text = event.text

        with undo.group(_("Button")):
            self.grid.actions.set_attr("button_cell", text)

        self.grid.ForceRefresh()

        self.grid.update_attribute_toolbar()

        event.Skip()
569430
function() {
    
    var obj;
    
    // not that the modal viewer is no longer active
    DataSaver.updateValue('modalActive', 'false');
    modalViewer.active = false;
    
    //Add active class to modal
    $('#sg-modal-container').removeClass('active');
    
    // remove the active class from all of the checkbox items
    $('.sg-checkbox').removeClass('active');
    
    // hide the modal
    modalViewer.hide();
    
    // update the wording
    $('#sg-t-patterninfo').html("Show Pattern Info");
    
    // tell the styleguide to close
    obj = JSON.stringify({ 'event': 'patternLab.patternModalClose' });
    document.getElementById('sg-viewport').contentWindow.postMessage(obj, modalViewer.targetOrigin);
    
  }
1110594
function previousPage () {
    if (!ctrl.canPageBack()) { return; }

    var newOffset = MdTabsPaginationService.decreasePageOffset(getElements(), ctrl.offsetLeft);

    // Set the new offset
    ctrl.offsetLeft = fixOffset(newOffset);
  }
1261241
private function renderPreviousButton()
    {
        $before = $this->page->before;
        $extraClass = $before ? '' : ' not-active';
        if (empty($before)) {
            $before = 1;
        }
        return $this->renderElement($before, $this->settings['label_previous'], 'prev'.$extraClass);
    }
1074382
public void reinitializeButtons() {

        if (isGroupcontainerEditing()) {
            m_groupEditor.reinitializeButtons();
        } else {
            List<CmsContainerPageElementPanel> elemWidgets = getAllContainerPageElements(true);

            for (CmsContainerPageElementPanel elemWidget : elemWidgets) {
                if (requiresOptionBar(elemWidget, elemWidget.getParentTarget())) {
                    getContainerpageUtil().addOptionBar(elemWidget);
                } else {
                    // otherwise remove any present option bar
                    elemWidget.setElementOptionBar(null);
                }
                elemWidget.showEditableListButtons();
            }
        }
    }
881469
function (state) {
        var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect;

        if (state != self._fullscreen) {
          $(window).on('resize', function () {
            var time;

            if (self._fullscreen) {
              // Time the layout time if it's to slow use a timeout to not hog the CPU
              if (!slowRendering) {
                time = new Date().getTime();

                var rect = DomUtils.getWindowSize();
                self.moveTo(0, 0).resizeTo(rect.w, rect.h);

                if ((new Date().getTime()) - time > 50) {
                  slowRendering = true;
                }
              } else {
                if (!self._timer) {
                  self._timer = Delay.setTimeout(function () {
                    var rect = DomUtils.getWindowSize();
                    self.moveTo(0, 0).resizeTo(rect.w, rect.h);

                    self._timer = 0;
                  }, 50);
                }
              }
            }
          });

          layoutRect = self.layoutRect();
          self._fullscreen = state;

          if (!state) {
            self.borderBox = BoxUtils.parseBox(self.settings.border);
            self.getEl('head').style.display = '';
            layoutRect.deltaH += layoutRect.headerH;
            $([documentElement, document.body]).removeClass(prefix + 'fullscreen');
            self.classes.remove('fullscreen');
            self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
          } else {
            self._initial = { x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h };

            self.borderBox = BoxUtils.parseBox('0');
            self.getEl('head').style.display = 'none';
            layoutRect.deltaH -= layoutRect.headerH + 2;
            $([documentElement, document.body]).addClass(prefix + 'fullscreen');
            self.classes.add('fullscreen');

            var rect = DomUtils.getWindowSize();
            self.moveTo(0, 0).resizeTo(rect.w, rect.h);
          }
        }

        return self.reflow();
      }
1218032
function() {
            var options = this.getSelected();

            // First update the displayed button text.
            $('button', this.$container).html(this.options.buttonText(options, this.$select));

            // Now update the title attribute of the button.
            $('button', this.$container).attr('title', this.options.buttonTitle(options, this.$select));

        }
708788
function() {
      if (this.propertyPanel.style.display == 'none') {
         this.propertyPanel.style.display = '';
         Dom.addClass(this.button, "opened");
      } else {
         this.propertyPanel.style.display = 'none';
         Dom.removeClass(this.button, "opened");
      }
   }
787859
def undobutton_action(self):
        
        if len(self.history) > 1:
            old = self.history.pop(-1)
            self.selection_array = old
            self.mask.set_data(old)
            self.fig.canvas.draw_idle()
153832
function(view){
		// Check if jQuery object is inside view, or is the view object itself
		var $nextView = this.saveView(view);

		// Reset flags
		this.endCurrPage = false;
		this.endNextPage = false;

		// Check if views are different
		// if($nextView == this.$currentView)
			// return false;

		// Restore current view class if already set
		if(this.$currentView)
			this.restoreView(this.$currentView);

		// Set nextView as current, with restored css values
		if($nextView){
			this.restoreView($nextView);
			this.$currentView = $nextView.addClass('pt-page-current');
		}else{
			this.$currentView = null;
		}

		// Reset animate flag
		this.isAnimating = false;

		// Trigger change-page event
		this.trigger('page-change');
		return true;
	}
1355406
function() {
        this.cfg.resetProperty(DEF_CFG.SELECTED.key);
        this.cfg.resetProperty(DEF_CFG.PAGEDATE.key);
        this.resetEvent.fire();
    }
487375
function(isDirty) {
      var t = this;

      // Pause a tour if the page turns dirty
      if (isDirty) {
        UI.pauseTour();
      }

      // Change the view elements
      t.$el.toggleClass('dirty', isDirty);
      if (!isDirty) {
        t.originalPage = t.model.toJSON({trim:false});
      }
    }
414557
function (callback) {
            async.until(
                // conditions for stopping the poll
                function () {
                    waitTimeOver = elapsed > constants.WAIT_TIMEOUT;
                    return waitTimeOver || domHasChanged;
                },
                function (callback) {
                    // polls the page at an interval
                    setTimeout(function () {
                        elapsed += constants.POLL_INTERVAL;
                        getData.takeSnapshot(page, ph, function (error, page, ph, newDom) {
                            if (error) {
                                callback(error);
                                return;
                            }
                            domHasChanged = helpers.domIsDifferent(originalDom, newDom);
                            callback();
                        });
                    }, constants.POLL_INTERVAL);
                },

                function (error) {
                    if (waitTimeOver) {
                        callback('Timeout while waiting for dom to change');
                        return;
                    }
                    callback(error);
                }
            );
        }
644277
def apply_clicked(self, button):
        
        if isinstance(self.model.state, LibraryState):
            return

        self.set_script_text(self.view.get_text())