prebid / prebid-universal-creative

Apache License 2.0
43 stars 71 forks source link

Fix bugs / tests with empty string default for missing assets #178

Closed dgirardi closed 2 years ago

dgirardi commented 2 years ago
patmmccann commented 2 years ago

@muuki88 could anyone from highfivve take a look?

muuki88 commented 2 years ago

@anitaschiller can take at look on Tuesday. She's out of office tomorrow and Monday.

Maybe I have some time tomorrow ☺️

muuki88 commented 2 years ago

@anitaschiller can take at look on Tuesday. She's out of office tomorrow and Monday.

Maybe I have some time tomorrow ☺️

@dgirardi can you elaborate on this statement?

Fix a bug with all possible template placeholders being incorrectly detected in some situations

dgirardi commented 2 years ago

@muuki88, can you spot it? :)

const placeholderIndex = (~doc.body.innerHTML.indexOf(placeholder)) ? doc.body.innerHTML.indexOf(placeholder) : (doc.head.innerHTML && doc.head.innerHTML.indexOf(placeholder));
if (~placeholderIndex) {
    placeholders.push(placeholderKey);
}

(a refresher, ~(-1) === 0). If the placeholder is not in body.innerHTML and head.innerHTML is falsy, the placeholder was not found but is still added to the list of found placeholders.