DOMManipulator

DOMManipulator

new DOMManipulator(settings)

Parameters:
Name Type Description
settings ExtensionSettings
Properties
Name Type Description
observationEnabled boolean
settings ExtensionSettings
settings ExtensionSettings

Methods

formatNode(node)

Formats paragraphs according to settings
Parameters:
Name Type Description
node HTMLElement Text content of paragraphs

getNewTrackingList() → {array}

Gets the new tracking list based on whether it's the same page
Returns:
array of HTMLElement
Type
array

observe(mutationList)

Observation handler
Parameters:
Name Type Description
mutationList array Array of MutationRecord's

reformatDOM()

Uses the list of currently tracked

tags and formats them according to settings

scanDOM()

Scans the DOM for

tags and listens for changes to the dom. Uses MutationObserver to check for DOM mutations and an interval for older browsers.

setState(newTrackingList)

Defers and updates state
Parameters:
Name Type Description
newTrackingList array A new list of

tags

shouldUpdate(newDOM, oldDOM)

Parameters:
Name Type Description
newDOM DOMTree
oldDOM DOMTree

toggleObservation()

Toggles the observation handler