1class ResponsiveBackgroundImage { 2 3 constructor(element) { 4 this.element = element; 5 this.img = element.querySelector('img'); 6 this.src = ''; 7 8 this.img.addEventListener('load', () => { 9 this.update(); 10 }); 11 12 if (this.img.complete) { 13 this.update(); 14 } 15 } 16 17 update() { 18 let src = typeof this.img.currentSrc !== 'undefined' ? this.img.currentSrc : this.img.src; 19 if (this.src !== src) { 20 this.src = src; 21 this.element.style.backgroundImage = 'url("' + this.src + '")'; 22 23 } 24 } 25} 26 27let elements = document.querySelectorAll('.responsive-background-image'); 28for (let i=0; i<elements.length; i++) { 29 new ResponsiveBackgroundImage(elements[i]); 30}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.