1.0.11 • Published 5 years ago

element-mutator-lib v1.0.11

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Not for a production!

It is for my "home" project and it has not unit tests and it is my playground. I strongly recommend to don't use it in production.

Installation

npm install element-mutator-lib

How to use

Example 1. Run after page is loaded and track all DOM changes.

import ElementMutator from 'element-mutator-lib';

const elementMutator = new ElementMutator({attributeFilter: []}, (cfg, node, attributeName) => {
    // do something
    elementMutator.stop(); // stop
});

Example 2. Track a specific DOM node and all his descendants (<body> body tag in that case).

import ElementMutator from 'element-mutator-lib';

const elementMutator = new ElementMutator({attributeFilter: [], node: document.body}, (cfg, node, attributeName) => {
    // do something
    elementMutator.stop(); // stop
});

Example 3. Track a specific DOM node attributes (href attribute in that case). If attributeName is undefined then mutation is a non attribute mutation.

import ElementMutator from 'element-mutator-lib';

const elementMutator = new ElementMutator({attributeFilter: [href]}, (cfg, node, attributeName) => {
    // do something
    elementMutator.stop(); // stop
});
1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago