Bug #104520
openRteHtmlParser does not allow custom attribute configuration for <span> tags as children of a <p> tag
100%
Description
We were wondering, why it is impossible to add custom attributes to <span> tags. It turns out, that the "allowedAttribs" definition is hard-coded only for <span> tags in RteHtmlParser.php! This issue was reported already 9 years ago but closed.
Wouldn't it makes much more sense to apply the YAML configuration processing.allowAttributes of Processing.yaml here as well, so we are able to customize it, like for any other tags?
Use-Case:
In CKEditor we want to add an editor-plugin for ToolTips which can be placed on whole headlines, paragraphs, but also on single words:
<h1>Hello <span data-tooltip-content="This works!" data-tooltip-position="auto">world</span></h1>
<p data-tooltip-content="This works!" data-tooltip-position="top">Hello world</p>
<p>Hello <span data-tooltip-content="Why is this not working?">world</span></p>
If we append these data-attributes to processing.allowAttributes, it works perfectly well for the <h1> and the <p> tag. But everything is stripped away from the <span> if <p> is the parent tag ! The header has a <span> as child to mark only one word, and here its working. So this should work on <p> as well, but it isn't.
Is there a reason for it or is this just a left-over behavior of old times? Our current (ugly) workaround is the usage of a composer-patch.
Background:
The JavaScript to init the tooltip uses the data-attribute like tooltip('[data-tooltip-content]', {}); with some default options, which can be overwritten by the data-attribute (see e.g. "data-tooltip-position" in the above example)