Halloween's over - let's stamp out these ZOMBIE merchandising components #11055
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.
This is a fix to a slightly obscure spacefinder bug.
Sometimes, inline merchandising components are added in spaces they really don't belong:
What's happening here? Aren't these things supposed to give headings clearance, because they're left aligned?
The rules they use certainly say so...
So is this just spacefinder on the fritz? Let's take a look at the comparison it does between the elements for the purposes of the
inlineMercPromise
...Both
isMinAbove
andisMinBelow
are false for this check. So spacefinder considers the paragraph in question ineligible for the inline merchandising component. Yet it displays there all the same. What gives?A look at
article-body-adverts.js
gives the answer...We're adding the inline merchandising ad names -
['im', 'im']
- regardless of whether the spacefinder actually finds a space for the IM component. So the next time we do add an advert, it'll be an IM component instead, even though there's no space for such a thing. Thus I have termed it a zombie merchandising component.Originally, this wouldn't have been a problem, because the IM element was added with
lenientRules
- how would we later find ad spaces with stricter rules? But thelenientRules
have been subtly changed at some point - they now have ah2
clearance that wouldn't otherwise be in place on desktop - and are now not quite aslenient
after all.The fix is to -
lenientRules
because their name is misleadingAnd now the zombie is gone, with the proper inline MPU in its place -