Qso
A MutationObserver like API for CSS selectors.
Install / Use
/learn @WebReflection/QsoREADME
Deprecated: QuerySelectorObserver
Please use qsa-observer instead, as it's been used in various other libraries, hence it's way more battle-tested, and better, than this initial attempt.
100% inspired by a Daniel's hack, this module brings a friendly MutationObserver like API to observe CSS selectors instead.
const so = new QuerySelectorObserver(records => {
for (const record of records) {
if (record.addedNodes.length) {
record.target.textContent = 'Hello via QSO!';
console.log(record.addedNodes);
} else {
console.log(record.removedNodes);
}
}
});
so.observe('.some-selector');
so.observe('#some-complex > .selector + p.cool');
button.onclick = () => so.disconnect();
Compatible with IE11 and other browsers, feel free to test it live.
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
