removes usage of deprecated jQuery.size() (#11874) #11883
Merged
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.
As discovered in #11874 the page overlay breaks when the overlayed page contains it's own version of jQuery. To be specific a version of the 3.x range.
Looking at the console log the culprit is https://api.jquery.com/size/ not being available on a selector result. It was dropped in 3.x after being deprecated since 1.8. And the jQuery from the opened site replaces the one packaged with Piwik.
This patch replaces all calls I could find with the suggested
.length
access. There are 2 additional calls in theAnonymousPiwikUsageMeasurement
plugin I know of but those need a separate PR.For good measurement I replaced all calls to
size()
with a boolean style.length
access. If the more prevalent style should be a real integer check like.length > 0
I will happily adjust them.