Setting multiple attributes and escaping
Browsers override duplicate attributes. Hence an element can only have one elb, elb-<entity> and/or elb-action definition at a time. Nevertheless it’s possible to define multiple entities, properties and/or actions all at once within one attribute using quotes and semicolons.
Key-value pairs are splitted by a semicolon. Therefore it’s necessary to escape values containing a semicolon. Quotes are here to meet your needs. To prevent a mistaken value-split use single quotes.
1
<!-- value wrapping with quotes -->
2
<p elb="foo" elb-foo="b:a;r">{ "b": "a", "r": true }</p>
3
<p elb="foo" elb-foo="b:'a;r'">{ "b": "a;r" }</p>
Copied!
If a single quote is part of the value escape it with a backslash:
1
<!-- escaping values with backslash -->
2
<p elb="foo" elb-foo="bar:it\'s escaped">{ "bar": "it's escaped" }</p>
Copied!
The semicolon can be used as a separator to list multiple values inside of an elb-property or elb-action.
1
<!-- using multiple key-value pairs at once -->
2
<p elb="foo" elb-foo="a:1;b:2">{ "a": 1, "b": 2 }</p>
Copied!
Last modified 11mo ago
Copy link