Skip to content

Commit

Permalink
do not select element that gets removed after dfp render (prebid#4423)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkimcm authored and afewcc committed Dec 10, 2019
1 parent e771855 commit bdd9461
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/secureCreatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ export function _sendAdToCreative(adObject, remoteDomain, source) {

function resizeRemoteCreative({ adUnitCode, width, height }) {
// resize both container div + iframe
['div:last-child', 'div:last-child iframe'].forEach(elmType => {
let element = getElementByAdUnit(elmType);
['div', 'iframe'].forEach(elmType => {
// not select element that gets removed after dfp render
let element = getElementByAdUnit(elmType + ':not([style*="display: none"])');
if (element) {
let elementStyle = element.style;
elementStyle.width = width + 'px';
Expand Down

0 comments on commit bdd9461

Please sign in to comment.