removeAllHandlers static method

void removeAllHandlers(
  1. HtmlDocument htmlDoc, [
  2. HtmlElement? selected = null
])

Removes all event handlers from all elements except selected on the browser DOM.

Implementation

static void removeAllHandlers(HtmlDocument htmlDoc,
    [HtmlElement? selected = null]) {
  //clone the items in the body to sever any event handlers
  log.info('Function : removeAllHandlers, '
      'Parameters : {[htmlDoc,$htmlDoc][selected,$selected]}');
  htmlDoc.body!.children
      .where((e) => e != selected)
      .toSet()
      .forEach(removeEventHandler);
  MyJS.removeAllTimers();
  log.fine('Function : removeAllHandlers, Return : void');
}