bannertime / generator-bannertime

Yeoman generator to help build and manage HTML5 banner campaigns.
https://bannertime.github.io/
58 stars 35 forks source link

fix: cannot add sources #67

Closed joemidi closed 6 years ago

joemidi commented 8 years ago

You get the following error:

Uncaught TypeError: Cannot read property 'appendChild' of undefined

when video sources are being added to the SmartObject

We could move

        if (this.options.sources) {
          const sources = this.options.sources;
          const fragment = document.createDocumentFragment();
          for (let i = 0; i < sources.length; i++) {
            const sourceTag = document.createElement('source');
            sourceTag.src = sources[i].url;
            sourceTag.type = sources[i].type;
            fragment.appendChild(sourceTag);
          }
          this.element.appendChild(fragment);
        }

into the applySettings() method.