From cac43afb169aba08c58b8e0a5a4ed571b9a7d950 Mon Sep 17 00:00:00 2001 From: MrGoumX Date: Mon, 18 Apr 2022 10:28:09 +0300 Subject: [PATCH] Add window.top.document as fallback document in plugins --- src/plugins/badge.coffee | 2 +- src/plugins/order_stash.coffee | 2 +- src/plugins/partner_sku_reviews.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/badge.coffee b/src/plugins/badge.coffee index 7c016491..55fcb951 100644 --- a/src/plugins/badge.coffee +++ b/src/plugins/badge.coffee @@ -595,7 +595,7 @@ class Badge _head: -> @parent_doc.head || @parent_doc.getElementsByTagName('head')[0] - _setParentDoc: -> @parent_doc = window.parent.document + _setParentDoc: -> @parent_doc = window.parent.document || window.top.document _ratingToStars: (rating = 0, limit = 5) -> return [] if @_noStars(rating) diff --git a/src/plugins/order_stash.coffee b/src/plugins/order_stash.coffee index 47a353d8..cddc2896 100644 --- a/src/plugins/order_stash.coffee +++ b/src/plugins/order_stash.coffee @@ -397,7 +397,7 @@ class OrderStash _head: -> @parent_doc.head || @parent_doc.getElementsByTagName('head')[0] _animationSupport: -> @$el.style.animation? - _setParentDoc: -> @parent_doc = window.parent.document + _setParentDoc: -> @parent_doc = window.parent.document || window.top.document _endpoint: -> params = diff --git a/src/plugins/partner_sku_reviews.coffee b/src/plugins/partner_sku_reviews.coffee index ac2c6153..f90902a8 100644 --- a/src/plugins/partner_sku_reviews.coffee +++ b/src/plugins/partner_sku_reviews.coffee @@ -415,7 +415,7 @@ class PartnerSkuReviews asset_url = (source) -> "#{settings.url.base}/assets/#{source}" constructor: -> - @parent_doc = window.parent.document + @parent_doc = window.parent.document || window.top.document @onDOMReady => @head = @parent_doc.getElementsByTagName('head')[0] @_renderAll()