Class: ElemHideEmulation

content/elemHideEmulation.ElemHideEmulation(hideElemsFunc, unhideElemsFunc)

Manages the front-end processing of element hiding emulation filters.

Constructor

new ElemHideEmulation(hideElemsFunc, unhideElemsFunc)

Parameters:
Name Type Description
hideElemsFunc module:content/elemHideEmulation~hideElemsFunc

A callback that should be provided to do the actual element hiding.

unhideElemsFunc module:content/elemHideEmulation~unhideElemsFunc

A callback that should be provided to unhide previously hidden elements.

Source:

Methods

(async) _addSelectors(stylesheetsopt, mutationsopt) → {Promise}

Processes the current document and applies all rules to it.

Parameters:
Name Type Attributes Description
stylesheets Array.<CSSStyleSheet> <optional>

The list of new stylesheets that have been added to the document and made reprocessing necessary. This parameter shouldn't be passed in for the initial processing, all of document's stylesheets will be considered then and all rules, including the ones not dependent on styles.

mutations Array.<MutationRecord> <optional>

The list of DOM mutations that have been applied to the document and made reprocessing necessary. This parameter shouldn't be passed in for the initial processing, the entire document will be considered then and all rules, including the ones not dependent on the DOM.

Source:
Returns:

A promise that is fulfilled once all filtering is completed

Type
Promise

_appendScheduledProcessing(stylesheetsopt, mutationsopt)

Appends new changes to the list of filters for the next time filtering is run.

Parameters:
Name Type Attributes Description
stylesheets Array.<CSSStyleSheet> <optional>

new stylesheets to be processed. This parameter should be omitted for full reprocessing.

mutations Array.<MutationRecord> <optional>

new DOM mutations to be processed. This parameter should be omitted for full reprocessing.

Source:

(async) _processFiltering() → {Promise}

Performed any scheduled processing.

This function is asyncronous, and should not be run multiple times in parallel. The flag _filteringInProgress is set and unset so you can check if it's already running.

Source:
Returns:

A promise that is fulfilled once all filtering is completed

Type
Promise

_readCssRules(stylesheetsopt) → {Array.<CSSStyleRule>}

Reads the rules out of CSS stylesheets

Parameters:
Name Type Attributes Description
stylesheets Array.<CSSStyleSheet> <optional>

The list of stylesheets to read.

Source:
Returns:
Type
Array.<CSSStyleRule>

_scheduleNextFiltering()

Schedule filtering to be processed in the future, or start processing immediately.

If processing is already scheduled, this does nothing.

Source:

parseSelector(selector) → {Array}

Parse the selector

Parameters:
Name Type Description
selector string

the selector to parse

Source:
Returns:

selectors is an array of objects, or null in case of errors.

Type
Array

queueFiltering(stylesheetsopt, mutationsopt)

Re-run filtering either immediately or queued.

Parameters:
Name Type Attributes Description
stylesheets Array.<CSSStyleSheet> <optional>

new stylesheets to be processed. This parameter should be omitted for full reprocessing.

mutations Array.<MutationRecord> <optional>

new DOM mutations to be processed. This parameter should be omitted for full reprocessing.

Source: