Issue #3608714: Fix rel and CSS classes being dropped when they are the only change
Closes #3608714
Problem
In ExternalLinkA11yFilter::process() a local $updated flag decides whether setProcessedText() is called. The rel-handling block set the rel attribute but never set $updated, so when a rel attribute was the only change it was written to the DOM and then silently discarded. Separately, the CSS-classes handling was nested inside the "Open in new window" (a11y_new_window) block, so the "CSS classes to add" setting had no effect unless that option was also enabled.
Changes
- Set
$updatedto TRUE when therelattribute is actually modified, and only write the attribute when a new value was added (strict de-duplication, no redundant re-serialization). - Move the CSS-classes handling out of the
a11y_new_windowblock so it applies to every processed link independently, setting$updatedwhen classes are added. - Add kernel test coverage: rel-only change preserved, rel value not duplicated, CSS classes applied without the a11y message, full external-link treatment, internal link left untouched.
Note
Behavior change: sites that set CSS classes but had the "Open in new window" message disabled will now get those classes applied (previously they were dropped). This is the intended fix.