fleigm
(Michael Fleig)
May 15, 2020, 12:46pm
#1
Hello everyone,
I’m trying to add an html attribute that contains a dot inside the key to an html attribute using the Fusion Augmenter.
Neos.Fusion:Augmenter {
some.key='value'
}
expected result:
<div some.key="value">
actual result:
<div></div>
Is there any way to escape the dot so it does not get interpreted as a nested fustion key?
mficzel
(Martin Ficzel)
May 15, 2020, 2:49pm
#2
i would expect this to work
Neos.Fusion:Augmenter {
'some.key'='value'
}
fleigm
(Michael Fleig)
May 18, 2020, 9:21am
#3
Thanks for you swift reply.
Sadly not it does not work.
'"some.key"'='value'
Doesn’t do the trick either
bwaidelich
(Bastian Waidelich)
May 19, 2020, 7:19am
#4
Unfortunately this seems not to be possible out of the box because the “.” is parsed as a property path by Fusion and AFAIK there is no way to escape it.
For now you could do a little hack:
root = 'Just a test'
root.@process.augment = Neos.Fusion:Augmenter {
'some###DOT###key' = 'value'
@process.replaceDot = ${String.replace(value, '###DOT###', '.')}
}
See https://fusionpen.punkt.de/fusionpen/7a94b1b2f19aaa1d203a0fc48656d19fc6efc1be.html
BTW: Are dots in attributes allowed in the HTML spec?
fleigm
(Michael Fleig)
May 19, 2020, 7:40am
#5
Thank you very much!
According to this it is allowed: https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 but I don’t think it is commonly used.
The javascript library AlpineJs uses it for its modifiers.
1 Like