Skip to content

Commit 90fe9a4

Browse files
committed
fix: update observer obseve parame to type and and attribute name to attributeFilter
1 parent 662aaba commit 90fe9a4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,17 @@ function addNewRules() {
324324
const observerInit = () => {
325325
observer.init({
326326
name: "ccCss",
327-
observe: ["childList"],
327+
types: ["addedNodes"],
328328
selector: "[class]",
329329
callback: (mutation) => {
330-
if (parse != "false") initElements(mutation.addedNodes);
330+
if (parse != "false") initElements([mutation.target]);
331331
}
332332
});
333333

334334
observer.init({
335335
name: "ccCss",
336-
observe: ["attributes"],
337-
attributeName: ["class", "className"],
336+
types: ["attributes"],
337+
attributeFilter: ["class", "className"],
338338
callback: (mutation) => {
339339
if (parse != "false") initElements([mutation.target]);
340340
}
@@ -343,20 +343,20 @@ const observerInit = () => {
343343

344344
observer.init({
345345
name: "cssParseAddedNode",
346-
observe: ["addedNodes"],
346+
types: ["addedNodes"],
347347
selector: "link[parse], link[save], link[object]",
348348
callback: (mutation) => {
349-
init(mutation.target);
349+
init([mutation.target]);
350350
}
351351
});
352352

353353
observer.init({
354354
name: "cssParseattributes",
355-
observe: ["attributes"],
356-
attributeName: ["parse", "save", "object"],
355+
types: ["attributes"],
356+
attributeFilter: ["parse", "save", "object"],
357357
selector: "link",
358358
callback: (mutation) => {
359-
init(mutation.target);
359+
init([mutation.target]);
360360
}
361361
});
362362

0 commit comments

Comments
 (0)