Pop all selection events off the end of a history array. Stop at a change event.
543521
function clearSelectionEvents(array) {
    while (array.length) {
      var last = lst(array);
      if (last.ranges) array.pop();
      else break;
    }
  }
1205077
function preventSelect(evt) {
    preventDefault(evt);
    if (window.getSelection) {
      window.getSelection().removeAllRanges();
    } else if (document.selection) {
      document.selection.clear();
    }
  }
109753
public void clearHistory()
	{
		int channels = inArray.length;
		for (int c=0; c<channels; c++)
		{
			for (int i=0; i<HISTORYSIZE; i++)
			{
				inArray[c][i] = outArray[c][i] = 0f;
			}
		}
	}
797537
def _finish_selecting(self, event):
        """"""
        self._selecting = False
        canvas = self._canvas
        x = canvas.canvasx(event.x)
        y = canvas.canvasy(event.y)
        
        canvas.coords(self._sobject, -1, -1, -1, -1)
        canvas.itemconfigure(self._sobject, state=tk.HIDDEN)

        sel_region = self._sstart[0], self._sstart[1], x, y
        canvas.region_selected = sel_region
        canvas.event_generate('<<RegionSelected>>')
525902
function endSelection() {
          var rng = doc.selection.createRange();

          // If the range is collapsed then use the last start range
          if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {
            startRng.select();
          }

          dom.unbind(doc, 'mouseup', endSelection);
          dom.unbind(doc, 'mousemove', selectionChange);
          startRng = started = 0;
        }
1288444
def clean_history(self, widget, event=None):
        
        self.history_tree_store.clear()
        selected_sm_m = self.model.get_selected_state_machine_model()
        if selected_sm_m:
            # the core may continue running without the GUI and for this it needs its execution histories
            if state_machine_execution_engine.finished_or_stopped():
                selected_sm_m.state_machine.destroy_execution_histories()
                self.update()
944890
function(element, selector, event, callback, capturePhase) {

    unbind($(element).array[0], event, callback, capturePhase)
  }
446858
function(view){

    // shut down the child view properly,
    // including events that the collection has from it
    if (view){
      this.stopListening(view);

      // call 'close' or 'remove', depending on which is found
      if (view.close) { view.close(); }
      else if (view.remove) { view.remove(); }

      this.children.remove(view);
    }

    this.triggerMethod("item:removed", view);
  }
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()
1165143
function() { // clear all the event listeners for every input and event type
				each(inp_change_events, function(event_type) {
					each(inps, function(inp) {
						rEL(inp, event_type, on_change);
					});
				});
			}
575322
def off(self, event, handler=None):
        """"""
        if handler:
            self.events[event].off(handler)
        else:
            del self.events[event]
            delattr(self, event)
1212147
def pop_all(self):
        
        with self.lock:
            output = list(self.queue)
            self.queue.clear()

        return output
923851
function(length) {
			var out = [];
			while (this.length > length) {
				out.push(this.pop());
			}
			if (out.length) {
				onchange(this, this.length - 1, out);
			}
		}
1067562
function() {
        if (this._transitionElement) {
            for (var i=this.transitionendEvents.length-1; i>=0; --i) {
                OpenLayers.Event.stopObserving(this._transitionElement,
                    this.transitionendEvents[i], this._removeBackBuffer);
            }
            delete this._transitionElement;
        }
        if(this.backBuffer) {
            if (this.backBuffer.parentNode) {
                this.backBuffer.parentNode.removeChild(this.backBuffer);
            }
            this.backBuffer = null;
            this.backBufferResolution = null;
            if(this.backBufferTimerId !== null) {
                window.clearTimeout(this.backBufferTimerId);
                this.backBufferTimerId = null;
            }
        }
    }
1105610
def pop(self, idx=None):
        
        if idx is not None:
            return self.database.run_script(
                'array_remove',
                keys=[self.key],
                args=[idx])
        else:
            return self.database.run_script(
                'array_pop',
                keys=[self.key],
                args=[])
443138
def pop_event(self):
        """"""
        if len(self.event_list) > 0:
            evt = self.event_list.pop(0)
            return evt
        return None
545732
def off(  # pylint: disable=keyword-arg-before-vararg
            self, event: str = None, *handlers: T.Callable
    ) -> None:
        """"""

        if not event:
            self._events.clear()
            return

        if event not in self._events:
            raise EventNotFound(event)

        if not handlers:
            self._events.pop(event)
            return

        for callback in handlers:
            if callback not in self._events[event]:
                raise HandlerNotFound(event, callback)
            while callback in self._events[event]:
                self._events[event].remove(callback)
        return