Compare commits

...

1 Commits

Author SHA1 Message Date
alihamuh
0bfeba807f clipper(core): added parser for extra characters (%,') 2023-03-03 09:36:21 +05:00
2 changed files with 14 additions and 4 deletions

View File

@@ -29,7 +29,8 @@
},
"scripts": {
"build": "tsc",
"test": "playwright test"
"test": "playwright test",
"watch": "tsc --watch"
},
"bugs": {
"url": "https://github.com/streetwriters/notesnook/issues"
@@ -40,4 +41,4 @@
"hyperapp": "^2.0.22",
"specificity": "^0.4.1"
}
}
}

View File

@@ -414,11 +414,20 @@ function parsePseudoSelector(selector: string) {
(s.name === "after" || s.name === "before")
);
if (pseduoElementIndex <= -1) continue;
output.push({
selector: stringify([part.slice(0, pseduoElementIndex)]),
selector: parseExtraCharacters(
stringify([part.slice(0, pseduoElementIndex)])
),
pseudoElement: stringify([part.slice(pseduoElementIndex)])
});
}
return output;
}
function parseExtraCharacters(selector: string) {
const extraCharacters = ["%", "'"];
for (const character of extraCharacters) {
selector = selector.replace(new RegExp(character, "g"), `\\${character}`);
}
return selector;
}