1class ProductCardSwatches extends HTMLElement { 2 connectedCallback() { 3 this.addEventListener('click', this.#onClick); 4 } 5 6 disconnectedCallback() { 7 this.removeEventListener('click', this.#onClick); 8 } 9 10 #onClick = (e) => { 11 const swatch = e.target.closest('[data-href]'); 12 if (swatch) { 13 e.preventDefault(); 14 e.stopPropagation(); 15 window.location.href = swatch.dataset.href; 16 } 17 }; 18} 19 20if (!customElements.get('product-card-swatches')) { 21 customElements.define('product-card-swatches', ProductCardSwatches); 22}
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.