Skip to content

Commit 707f2d9

Browse files
committed
Change how CSS from the style attribute is detected, when using postcss-html custom syntax. Fixes #180
1 parent 7db7174 commit 707f2d9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

rules/properties-order/tests/flat.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,15 @@ testRule({
566566
</html>
567567
`,
568568
},
569+
{
570+
description: 'ignore top-level declarations in style tag',
571+
code: `
572+
<style>
573+
color: tomato;
574+
top: 0;
575+
</style>
576+
`,
577+
},
569578
],
570579

571580
reject: [

utils/getContainingNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function getContainingNode(node) {
99
}
1010

1111
// postcss-html `style` attributes: declarations are children of Root node
12-
if (node.parent?.document?.nodes?.some((item) => item.type === 'root')) {
12+
if (node.parent?.source.inline === true) {
1313
return node.parent;
1414
}
1515

0 commit comments

Comments
 (0)