Skip to content

Commit 4268b90

Browse files
committed
Ad fix for "null" on Edge.
1 parent 39e0410 commit 4268b90

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dev/lib/native.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,16 @@ window._native_go = function (json) {
9696

9797
selectedClass.forEach(function (className, index) {
9898
var selectedTarget = document.getElementsByClassName(options['targetClass'])[index];
99-
var adElement = selectedTarget.innerHTML;
99+
var adElement = selectedTarget.innerHTML||"";
100100
var prefix = options['prefix'];
101101
var ad = ads[index];
102102

103103
if (ad && className) {
104104
var adInnerHtml = adElement.replace(new RegExp('#' + prefix + '_bg_color#', 'g'), ad['backgroundColor']).replace(new RegExp('#' + prefix + '_bg_color_hover#', 'g'), ad['backgroundHoverColor']).replace(new RegExp('#' + prefix + '_company#', 'g'), ad['company']).replace(new RegExp('#' + prefix + '_cta#', 'g'), ad['callToAction']).replace(new RegExp('#' + prefix + '_cta_bg_color#', 'g'), ad['ctaBackgroundColor']).replace(new RegExp('#' + prefix + '_cta_bg_color_hover#', 'g'), ad['ctaBackgroundHoverColor']).replace(new RegExp('#' + prefix + '_cta_color#', 'g'), ad['ctaTextColor']).replace(new RegExp('#' + prefix + '_cta_color_hover#', 'g'), ad['ctaTextColorHover']).replace(new RegExp('#' + prefix + '_desc#', 'g'), ad['description']).replace(new RegExp('#' + prefix + '_index#', 'g'), prefix + '-' + ad['i']).replace(new RegExp('#' + prefix + '_img#', 'g'), ad['image']).replace(new RegExp('#' + prefix + '_small_img#', 'g'), ad['smallImage']).replace(new RegExp('#' + prefix + '_link#', 'g'), ad['statlink']).replace(new RegExp('#' + prefix + '_logo#', 'g'), ad['logo']).replace(new RegExp('#' + prefix + '_color#', 'g'), ad['textColor']).replace(new RegExp('#' + prefix + '_color_hover#', 'g'), ad['textColorHover']).replace(new RegExp('#' + prefix + '_title#', 'g'), ad['title']);
105-
106-
selectedTarget.innerHTML = null;
107-
selectedTarget.innerHTML += adInnerHtml + _native.pixel(ad['pixel'], ad['timestamp']);
105+
selectedTarget.innerHTML = adInnerHtml + _native.pixel(ad['pixel'], ad['timestamp']);
108106
selectedTarget.setAttribute('data-state', 'visible');
109107
} else {
110-
selectedTarget.innerHTML = null;
108+
selectedTarget.innerHTML = "";
111109
}
112110
});
113111
};

0 commit comments

Comments
 (0)