jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/382212 )

Change subject: Do not call .offset() on $( 'html' )
......................................................................


Do not call .offset() on $( 'html' )

jQuery Migrate generates a warning for it and it may or may not
actually be supported. I think these are the only places where
it may happen and wasn't already special-cased for other reasons.

Bug: T177252
Change-Id: I0f6db1f3b0e049c812f230215ce5cd5ffa633856
---
M src/toolgroups/PopupToolGroup.js
M src/widgets/PopupWidget.js
2 files changed, 9 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  VolkerE: Looks good to me, approved
  Jforrester: Looks good to me, but someone else must approve



diff --git a/src/toolgroups/PopupToolGroup.js b/src/toolgroups/PopupToolGroup.js
index 6691dc5..65caa10 100644
--- a/src/toolgroups/PopupToolGroup.js
+++ b/src/toolgroups/PopupToolGroup.js
@@ -194,7 +194,9 @@
                        if ( this.isClippedHorizontally() ) {
                                // Anchoring to the right also caused the popup 
to clip, so just make it fill the container
                                containerWidth = 
this.$clippableScrollableContainer.width();
-                               containerLeft = 
this.$clippableScrollableContainer.offset().left;
+                               containerLeft = 
this.$clippableScrollableContainer[ 0 ] === document.documentElement ?
+                                       0 :
+                                       
this.$clippableScrollableContainer.offset().left;
 
                                this.toggleClipping( false );
                                this.$element.removeClass( 
'oo-ui-popupToolGroup-right' );
diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index acc7bd0..ce1ef5a 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -463,7 +463,9 @@
        floatablePos = this.$floatableContainer.offset();
        floatablePos[ far ] = floatablePos[ near ] + this.$floatableContainer[ 
'outer' + sizeProp ]();
        // Measure where the offsetParent is and compute our position based on 
that and parentPosition
-       offsetParentPos = this.$element.offsetParent().offset();
+       offsetParentPos = this.$element.offsetParent()[ 0 ] === 
document.documentElement ?
+               { top: 0, left: 0 } :
+               this.$element.offsetParent().offset();
 
        if ( positionProp === near ) {
                popupPos[ near ] = offsetParentPos[ near ] + parentPosition[ 
near ];
@@ -499,7 +501,9 @@
        }
 
        // Check if the popup will go beyond the edge of this.$container
-       containerPos = this.$container.offset();
+       containerPos = this.$container[ 0 ] === document.documentElement ?
+               { top: 0, left: 0 } :
+               this.$container.offset();
        containerPos[ far ] = containerPos[ near ] + this.$container[ 'inner' + 
sizeProp ]();
        // Take into account how much the popup will move because of the 
adjustments we're going to make
        popupPos[ near ] += ( positionProp === near ? 1 : -1 ) * 
positionAdjustment;

-- 
To view, visit https://gerrit.wikimedia.org/r/382212
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0f6db1f3b0e049c812f230215ce5cd5ffa633856
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: VolkerE <volke...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to