To request a high priority event, we induce a mutation observer by toggling the text of a text node between "1" and "-1".
480710
function makeRequestCallFromMutationObserver(callback) {
    var toggle = 1;
    var observer = new BrowserMutationObserver(callback);
    var node = document.createTextNode("");
    observer.observe(node, {characterData: true});
    return function requestCall() {
        toggle = -toggle;
        node.data = toggle;
    };
}
197612
public void gotoFreshPosWritable1(int oldIndex, int newIndex, int xor) {
        stabilize(oldIndex);
        gotoFreshPosWritable0(oldIndex, newIndex, xor);
    }
851634
function setupBodyMutationObserver() {
    function addImageLoadListners(mutation) {
      function addImageLoadListener(element) {
        if (false === element.complete) {
          log('Attach listeners to ' + element.src)
          element.addEventListener('load', imageLoaded, false)
          element.addEventListener('error', imageError, false)
          elements.push(element)
        }
      }

      if (mutation.type === 'attributes' && mutation.attributeName === 'src') {
        addImageLoadListener(mutation.target)
      } else if (mutation.type === 'childList') {
        Array.prototype.forEach.call(
          mutation.target.querySelectorAll('img'),
          addImageLoadListener
        )
      }
    }

    function removeFromArray(element) {
      elements.splice(elements.indexOf(element), 1)
    }

    function removeImageLoadListener(element) {
      log('Remove listeners from ' + element.src)
      element.removeEventListener('load', imageLoaded, false)
      element.removeEventListener('error', imageError, false)
      removeFromArray(element)
    }

    function imageEventTriggered(event, type, typeDesc) {
      removeImageLoadListener(event.target)
      sendSize(type, typeDesc + ': ' + event.target.src, undefined, undefined)
    }

    function imageLoaded(event) {
      imageEventTriggered(event, 'imageLoad', 'Image loaded')
    }

    function imageError(event) {
      imageEventTriggered(event, 'imageLoadFailed', 'Image load failed')
    }

    function mutationObserved(mutations) {
      sendSize(
        'mutationObserver',
        'mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type
      )

      // Deal with WebKit / Blink asyncing image loading when tags are injected into the page
      mutations.forEach(addImageLoadListners)
    }

    function createMutationObserver() {
      var target = document.querySelector('body'),
        config = {
          attributes: true,
          attributeOldValue: false,
          characterData: true,
          characterDataOldValue: false,
          childList: true,
          subtree: true
        }

      observer = new MutationObserver(mutationObserved)

      log('Create body MutationObserver')
      observer.observe(target, config)

      return observer
    }

    var elements = [],
      MutationObserver =
        window.MutationObserver || window.WebKitMutationObserver,
      observer = createMutationObserver()

    return {
      disconnect: function() {
        if ('disconnect' in observer) {
          log('Disconnect body MutationObserver')
          observer.disconnect()
          elements.forEach(removeImageLoadListener)
        }
      }
    }
  }
472334
public void offer(Event event) {
        sequence += event.toString();
        
        //check pattern matching
        if (patterns != null && sequence.length() > 0) {
            for (int i = 0; i < patterns.length; i++) {
                if (sequence.matches(patterns[i])) {
                    listener.patternMatches(i, sequence);
                    
                    //nullify sequence;
                    sequence = "";
                    return;
                }
            }
        }
        
        //check the amount of detected event and notify listener
        //if limit reached.
        if (count > 0 && sequence.length() == count) {
            listener.countMatches(sequence);
            sequence = "";
            count = -1;
        }
    }
202929
protected void updateNotifier(Notifier value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      findAndReplaceSimpleElement(innerCount, root, "type", value.getType(), "mail");
      findAndReplaceSimpleElement(innerCount, root, "sendOnError",
               (value.isSendOnError() == true) ? null : String.valueOf(value.isSendOnError()), "true");
      findAndReplaceSimpleElement(innerCount, root, "sendOnFailure",
               (value.isSendOnFailure() == true) ? null : String.valueOf(value.isSendOnFailure()), "true");
      findAndReplaceSimpleElement(innerCount, root, "sendOnSuccess",
               (value.isSendOnSuccess() == true) ? null : String.valueOf(value.isSendOnSuccess()), "true");
      findAndReplaceSimpleElement(innerCount, root, "sendOnWarning",
               (value.isSendOnWarning() == true) ? null : String.valueOf(value.isSendOnWarning()), "true");
      findAndReplaceSimpleElement(innerCount, root, "address", value.getAddress(), null);
      findAndReplaceProperties(innerCount, root, "configuration", value.getConfiguration());
   }
132711
@Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

        if (findFocus() != null) {
            currentFocus = Integer.parseInt(findFocus().getTag().toString());
        }

        if (count == 1 && s.length() == mNumberCharacters) {
            if (currentFocus == (mNumberPinBoxes - 1) || currentFocus == 0) {
                checkPinBoxesAvailableOrder();
            } else {
                checkPinBoxesAvailable();
            }

        }
    }
1003854
def _notify_add(self, slice_):
        """"""
        change = AddChange(self, slice_)
        self.notify_observers(change)
825593
function (value, sendUpdatedEvt) {
		
			var i, length, choice, firstIndexAvailable, choiceFound = false;
		
			for (i = 0, length = this.choicesList.length; i < length ; i += 1) {
			
				if (this.choicesList[i].visible) {
				
					choice = this.choicesList[i];
				
					if (value === choice.value) {
					
						choice.node.selected = "selected";
						choiceFound = true;
						break; // choice node already found
					
					} else if (lang.isUndefined(firstIndexAvailable)) {
					
						firstIndexAvailable = i;
					}
				
				}
			
			}
			
			// select value from first choice available when
			// value not matching any visible choice
			//
			// if no choice available (-> firstIndexAvailable is undefined), skip value setting
			if (!choiceFound && !lang.isUndefined(firstIndexAvailable)) {
				
				choice = this.choicesList[firstIndexAvailable];
				choice.node.selected = "selected";
				value = choice.value;
				
			}
			
			// Call Field.setValue to set class and fire updated event
			inputEx.SelectField.superclass.setValue.call(this, value, sendUpdatedEvt);
		}
1012715
function (value) {
        checkDisposed(this);
        if (this.isStopped) { return; }
        var now = this.scheduler.now();
        this.q.push({ interval: now, value: value });
        this._trim(now);

        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
          var observer = os[i];
          observer.onNext(value);
          observer.ensureActive();
        }
      }
171263
function executePatch(patches) {
	for (let i = 0; i < patches.length; i++) {
		const patch = patches[i];

		switch (patch.type) {
			case patchTypes.updateText: {
				// Update text of a node with new text.
				const nodeOld = patch.nodeOld;
				const nodeNew = patch.nodeNew;

				nodeOld.element.textContent = nodeNew.data[""];
				nodeOld.node = nodeNew;

				break;
			}

			case patchTypes.updateData: {
				// Set attributes and events of a node with new data.
				const nodeOld = patch.nodeOld;
				const nodeOldNodeData = nodeOld.node.data;
				const nodeOldElement = nodeOld.element;
				const nodeNew = patch.nodeNew;
				const nodeNewData = nodeNew.data;

				// Set attributes on the DOM element.
				for (let key in nodeNewData) {
					const value = nodeNewData[key];

					if (key[0] === "@") {
						// Update the event listener.
						nodeOldElement.MoonEvents[key] = value;
					} else if (key !== "children") {
						// Remove the attribute if the value is false, and update it
						// otherwise.
						if (value === false) {
							nodeOldElement.removeAttribute(key);
						} else {
							nodeOldElement.setAttribute(key, value);
						}
					}
				}

				// Remove old attributes.
				for (let key in nodeOldNodeData) {
					if (!(key in nodeNewData)) {
						nodeOldElement.removeAttribute(key);
					}
				}

				nodeOld.node = nodeNew;

				break;
			}

			case patchTypes.appendNode: {
				// Append a node to the parent.
				const nodeParent = patch.nodeParent;
				const nodeOldNew = executeCreate(patch.nodeNew);

				nodeParent.element.appendChild(nodeOldNew.element);
				nodeParent.children.push(nodeOldNew);

				break;
			}

			case patchTypes.removeNode: {
				// Remove a node from the parent.
				const nodeParent = patch.nodeParent;

				// Pops the last child because the patches still hold a reference
				// to them. The diff phase can only create this patch when there
				// are extra old children, and popping nodes off of the end is more
				// efficient than removing at a specific index, especially because
				// they are equivalent in this case.
				nodeParent.element.removeChild(nodeParent.children.pop().element);

				break;
			}

			case patchTypes.replaceNode: {
				// Replaces an old node with a new node.
				const nodeOld = patch.nodeOld;
				const nodeOldElement = nodeOld.element;
				const nodeNew = patch.nodeNew;
				const nodeOldNew = executeCreate(nodeNew);
				const nodeOldNewElement = nodeOldNew.element;

				nodeOldElement.parentNode.replaceChild(nodeOldNewElement, nodeOldElement);

				nodeOld.element = nodeOldNewElement;
				nodeOld.node = nodeOldNew.node;
				nodeOld.children = nodeOldNew.children;

				break;
			}
		}
	}

	// Remove the current execution from the queue.
	executeQueue.shift();

	// If there is new data in the execution queue, continue to it.
	if (executeQueue.length !== 0) {
		if (performance.now() - executeStart >= 16) {
			// If the current frame doesn't have sufficient time left to keep
			// running then start the next execution in the next frame.
			requestAnimationFrame(() => {
				executeStart = performance.now();

				executeNext();
			});
		} else {
			executeNext();
		}
	}
}
840139
function (data) {
            if (this._changeEventQueue) {
                this._changeEventQueue = _.union(this._changeEventQueue, data.ids);
            } else {
                this.trigger(PREFERENCE_CHANGE, data);
            }
        }
887808
private void onCursorChanged(final Event event, final Suggestion<T> suggestion) {
        TypeaheadCursorChangedEvent.fire(this, suggestion, event);
    }
149656
def OnContentChange(self, event):
        """"""

        self.ignore_changes = True
        self.SetValue(u"" if event.text is None else event.text)

        self.ignore_changes = False

        event.Skip()
1111926
function () {
            newEdit = {
                type: "textInsert",
                content: newChild.content,
                parentID: newChild.parent.tagID
            };

            // text changes will generally have afterID and beforeID, but we make
            // special note if it's the first child.
            if (textAfterID) {
                newEdit.afterID = textAfterID;
            } else {
                newEdit.firstChild = true;
            }
            newEdits.push(newEdit);

            // The text node is in the new tree, so we move to the next new tree item
            newIndex++;
        }
397369
function observeStyleChanges (element, stylesToObserve, onChange) {
    var oldStyles = {};

    var getStyle = function getStyle(style) {
      switch (style) {
      case 'width':
        return $(element).width();

      case 'height':
        return $(element).height();

      default:
        return $(element).css(style);
      }
    };

    // get the inital values
    $.forEach(stylesToObserve, function(style) {
      oldStyles[style] = getStyle(style);
    });

    var observer = new MutationObserver(function(mutations) {
      var changeSet = {};

      $.forEach(mutations, function(mutation) {
        if (mutation.attributeName !== 'style') return;

        var isHidden = $.isDisplayNone(element);

        $.forEach(stylesToObserve, function(style) {
          if(isHidden && (style === 'width' || style === 'height')) return;

          var newValue = getStyle(style);

          if (newValue !== oldStyles[style]) {
            changeSet[style] = [oldStyles[style], newValue];
            oldStyles[style] = newValue;
          }
        });
      });

      if (!$.isEmpty(changeSet)) {
        // Do this after so as to help avoid infinite loops of mutations.
        $.callAsync(function() {
          onChange.call(null, changeSet);
        });
      }
    });

    observer.observe(element, {
      attributes:true,
      attributeFilter: ['style'],
      childList:false,
      characterData:false,
      subtree:false
    });

    return observer;
  }
163926
function (notifyText) {
			this.writeDebug('notify',notifyText);
			if (this.settings.callbackNotify) {
				this.settings.callbackNotify.call(this, notifyText);
			}
			else {
				alert(notifyText);
			}
		}
918813
function() {
		if (gui.Client.hasMutations) {
			if (!this._observer) {
				var Observer = this._mutationobserver();
				this._observer = new Observer(function(mutations) {
					mutations.forEach(function(mutation) {
						gui.DOMObserver._handleMutation(mutation);
					});
				});
			}
			this._connect(true);
			this.observes = true;
		} else {
			throw new Error('MutationObserver no such thing');
		}
	}