Open westonruter opened 2 months ago
Note: The one current use case for tag visitor dependencies (Enhanced Responsive Images depending on Image Prioritizer) is going to be undone per https://github.com/WordPress/performance/pull/1476#issuecomment-2297032967. The code the former is going to be moved to the latter.
In at least one case, there is a need currently for a tag visitor to run after another tag visitor has run:
https://github.com/WordPress/performance/blob/e34711dbf286a16523b3c3d35462e0e79ea4c6f9/plugins/auto-sizes/optimization-detective.php#L54-L66
The tag visitor in Enhanced Responsive Sizes needs to run after the IMG tag visitor be
The Image Prioritizer's tag visitor is currently registered with the name ID of
img-tags
which is not ideal:https://github.com/WordPress/performance/blob/e34711dbf286a16523b3c3d35462e0e79ea4c6f9/plugins/image-prioritizer/helper.php#L33-L35
It should rather be prefixed like
image-prioritizer-img
. Theimage-prioritizer-img
string could even be defined as a class constant likeImage_Prioritizer_Img_Tag_Visitor::ID
. When Enhanced Responsive Sizes registers its tag visitor, it should be able to explicitly declare this dependency:Then there wouldn't be a need to rely on action priorities (and the current implementation of
OD_Tag_Visitor_Registry
) to ensure that one tag visitor runs before another.