Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 77x 1x 1x 76x 76x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 77x 61x 61x 61x 83x 55x 55x 55x 55x 61x 77x | /** @import { Ast } from '#compiler' */ /** @import { Context } from '../types' */ import * as e from '../../../errors.js'; import { get_attribute_chunks } from '../../../utils/ast.js'; import { mark_subtree_dynamic } from './shared/fragment.js'; /** * @param {Ast.StyleDirective} node * @param {Context} context */ export function StyleDirective(node, context) { if (node.modifiers.length > 1 || (node.modifiers.length && node.modifiers[0] !== 'important')) { e.style_directive_invalid_modifier(node); } if (node.value === true) { // get the binding for node.name and change the binding to state let binding = context.state.scope.get(node.name); if (binding) { if (binding.kind !== 'normal') { node.metadata.expression.has_state = true; } } mark_subtree_dynamic(context.path); } else { context.next(); for (const chunk of get_attribute_chunks(node.value)) { if (chunk.type !== 'ExpressionTag') continue; node.metadata.expression.has_state ||= chunk.metadata.expression.has_state; node.metadata.expression.has_call ||= chunk.metadata.expression.has_call; } } } |