feat(coremedia-richtext): TSdoc and allowEmpty (XLink) #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds TSdoc and a new feature to
setXLinkAttributes
inXLink
tooling.allowEmpty
is required to betrue
if, for example, you need to explicitly set a value for a required attribute and it must not be skipped (such as an<a>
which aways requiresxlink:href
to comply with CoreMedia Rich Text DTD 1.0.To not break existing usages,
allowEmpty
must default tofalse
.Decide on breaking change:
As additional part of this PR, also decided to align the behavior of
setXLinkDataSetEntries
with
setXLinkAttributes
, thus, to (by default) drop attributes with empty values. While thisis aligned with the DevNote that existed before, this has to be considered a breaking change.
Usages that rely on "empty values" to be accepted, need to explicitly add
allowEmpty = true
to the call.The defensive option would be to set the default to
true
for this method, but this again makes it harder to "learn the API by heart" due to the difference ofsetXLinkAttributes
.As an alternative to this, perhaps even the better one, is to make
allowEmpty
default totrue
for both. For a newly developed API, this would be my recommendation as "stripping given (empty) values" is more of a convenience behavior that spares some extra lines to filter the attributes before handing them over to the API.This again, would of course also be breaking, but this time for
setXLinkAttributes
.