Mesh attribute value setting.

Description

Add a facility to set attributes in Mesh.

Setting an attribute will take the form mx:attr-_foo_="test", where _foo_ is the name of the attribute to set (with no namespace). The value is a MEXL expression. Thus the following would set an image alt attribute for several images using mx:each:

If the result of the expression is Boolean, the attribute will be considered a Boolean attribute, e.g. set as foo="foo" in XHTML and serialized as simply foo in HTML (depending on the serialization settings).

It is expected that future tickets will allow pre/post insertion, as well as special handling for token sets (e.g. CSS class) and kebab-case token sequences (e.g. lang). These will likely be specified using some underscore attribute name convention, such as mx:attr_append="…". A future improvement may also allow for other namespaces to be specified, e.g. mx:attr-foo__bar_append="…" to append to the foo:bar attribute. Possibly a separate Mesh attribute would be provided to associate namespaces with prefixes for use with Mesh.

Compare how Thymeleaf sets attribute values.

Using this facility for template links, such as mx:attr-src instead of mx:src with interpolation, will obviate the need for GUISE-184.

Environment

None

Activity

Show:
Garret Wilson
March 6, 2021, 3:52 PM

For now, even though (X)HTML allows a more extension set of characters, for now we can restrict character names to start with an ASCII letter and consist of word characters and/or dashes.

Fixed

Assignee

Garret Wilson

Reporter

Garret Wilson

Labels

None

Epic Link

Components

Fix versions

Priority

Critical