1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

Clipper: Fixes #12683: Fix web clipper fails to clip pages that include comments in inline styles (#12686)

This commit is contained in:
Henry Heino
2025-07-09 00:42:23 -07:00
committed by GitHub
parent 1387470f2a
commit 7212269107
3 changed files with 5 additions and 1 deletions

View File

@@ -0,0 +1 @@
<p><span style="/* Comment */ text-decoration: underline;">Test</span>. In the past, <span style="font-size: auto;/* Test! */">comments</span> in CSS have caused issues.</p>

View File

@@ -0,0 +1 @@
<ins>Test</ins>. In the past, comments in CSS have caused issues.

View File

@@ -124,6 +124,8 @@ export function getStyleProp(node, name) {
const o = css.parse('div {' + style + '}');
if (!o.stylesheet.rules.length) return null;
const prop = o.stylesheet.rules[0].declarations.find(d => d.property.toLowerCase() === name);
const prop = o.stylesheet.rules[0].declarations.find(d => {
return d.type === 'declaration' && d.property.toLowerCase() === name;
});
return prop ? prop.value : null;
}