wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

ALR Hash are not injected on tags with special characters

Open MathieuLamiot opened this issue 1 year ago • 1 comments

Context

In 3.17 feature, with the DOM x Regex processor, some hashes are not injected when they should because the opening tag has special characters that got re-written by the DOMDocument. Hence, they are not found when trying to replace in the HTML file. Overall, the issue is that DOMDocument rewrites some stuff in the opening tag, preventing us to identify it back in the HTML here.

Expected behavior

  • Opening tags with special characters that should have the LRC hash injected must get the hash injected.

Acceptance Criteria On a template with an eligible opening tag with special characters, the tag should get the hash injected: for example: 1554_template has the opening tag:

<div data-elementor-type="popup" data-elementor-id="987" class="elementor elementor-987 elementor-location-popup" data-elementor-settings="{&quot;entrance_animation&quot;:&quot;fadeIn&quot;,&quot;prevent_scroll&quot;:&quot;yes&quot;,&quot;avoid_multiple_popups&quot;:&quot;yes&quot;,&quot;entrance_animation_duration&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:1.2,&quot;sizes&quot;:[]},&quot;triggers&quot;:{&quot;scrolling_offset&quot;:60,&quot;exit_intent&quot;:&quot;yes&quot;,&quot;scrolling&quot;:&quot;yes&quot;,&quot;scrolling_direction&quot;:&quot;down&quot;},&quot;timing&quot;:{&quot;devices&quot;:&quot;yes&quot;,&quot;times_times&quot;:2,&quot;times&quot;:&quot;yes&quot;,&quot;devices_devices&quot;:[&quot;desktop&quot;,&quot;tablet&quot;,&quot;mobile&quot;]}}"> which get re-written by DOMDocument to: <div data-elementor-type="popup" data-elementor-id="987" class="elementor elementor-987 elementor-location-popup" data-elementor-settings='{"entrance_animation":"fadeIn","prevent_scroll":"yes","avoid_multiple_popups":"yes","entrance_animation_duration":{"unit":"px","size":1.2,"sizes":[]},"triggers":{"scrolling_offset":60,"exit_intent":"yes","scrolling":"yes","scrolling_direction":"down"},"timing":{"devices":"yes","times_times":2,"times":"yes","devices_devices":["desktop","tablet","mobile"]}}'>

MathieuLamiot avatar Sep 08 '24 12:09 MathieuLamiot

Another case related to this: https://secure.helpscout.net/conversation/2872653381/545335

suzoutlet avatar Mar 20 '25 07:03 suzoutlet