Sha256: b5a804174d8ff84b7c2ab2cad2ff9c0185e4905d829da5cd48c3a2990ffb1871
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 Bytes
Contents
export default function transformQuotedBindingsIntoJustBindings( /* env */) { return { name: 'transform-quoted-bindings-into-just-bindings', visitor: { ElementNode(node) { let styleAttr = getStyleAttr(node); if (!validStyleAttr(styleAttr)) { return; } styleAttr.value = styleAttr.value.parts[0]; }, }, }; } function validStyleAttr(attr) { if (!attr) { return false; } let value = attr.value; if (!value || value.type !== 'ConcatStatement' || value.parts.length !== 1) { return false; } let onlyPart = value.parts[0]; return onlyPart.type === 'MustacheStatement'; } function getStyleAttr(node) { let attributes = node.attributes; for (let i = 0; i < attributes.length; i++) { if (attributes[i].name === 'style') { return attributes[i]; } } return undefined; }
Version data entries
3 entries across 3 versions & 1 rubygems