Open cjroebuck opened 1 week ago
@cjroebuck
I'm not sure if I understood your question correctly, but it is possible if you pass the root node as the first argument to findAndReplace
.
Please refer to the example below:
https://stackblitz.com/edit/vitejs-vite-a32wos?file=main.js
import { findAndReplace } from 'dom-find-and-replace';
findAndReplace(
// root node
document.getElementById('content'),
{
// find text 'hello'
find: 'hello',
// replace to 'HELLO'
replace: 'HEELO',
}
);
Hi there, how would you adapt this to recurse through the DOM tree, so that we could give it a root node, such as document.body and it would find all the text within the DOM to replace?