1/** Shopify CDN: Minification failed 2 3Line 16:0 Transforming class syntax to the configured target environment ("es5") is not supported yet 4Line 17:13 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 5Line 30:6 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 6Line 41:7 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 7Line 48:16 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 8Line 59:21 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 9Line 74:21 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 10Line 74:37 Transforming default arguments to the configured target environment ("es5") is not supported yet 11Line 80:17 Transforming object literal extensions to the configured target environment ("es5") is not supported yet 12Line 81:4 Transforming const to the configured target environment ("es5") is not supported yet 13... and 2 more hidden warnings 14 15**/ 16class CartNotification extends HTMLElement { 17 constructor() { 18 super(); 19 20 this.notification = document.getElementById('cart-notification'); 21 this.header = document.querySelector('sticky-header'); 22 this.onBodyClick = this.handleBodyClick.bind(this); 23 24 this.notification.addEventListener('keyup', (evt) => evt.code === 'Escape' && this.close()); 25 this.querySelectorAll('button[type="button"]').forEach((closeButton) => 26 closeButton.addEventListener('click', this.close.bind(this)) 27 ); 28 } 29 30 open() { 31 this.notification.classList.add('animate', 'active'); 32 33 this.notification.addEventListener('transitionend', () => { 34 this.notification.focus(); 35 trapFocus(this.notification); 36 }, { once: true }); 37 38 document.body.addEventListener('click', this.onBodyClick); 39 } 40 41 close() { 42 this.notification.classList.remove('active'); 43 document.body.removeEventListener('click', this.onBodyClick); 44 45 removeTrapFocus(this.activeElement); 46 } 47 48 renderContents(parsedState) { 49 this.cartItemKey = parsedState.key;
50 this.getSectionsToRender().forEach((section => { 51 document.getElementById(section.id).innerHTML = 52 this.getSectionInnerHTML(parsedState.sections[section.id], section.selector); 53 })); 54 55 if (this.header) this.header.reveal(); 56 this.open(); 57 } 58 59 getSectionsToRender() { 60 return [ 61 { 62 id: 'cart-notification-product', 63 selector: `[id="cart-notification-product-${this.cartItemKey}"]`, 64 }, 65 { 66 id: 'cart-notification-button' 67 }, 68 { 69 id: 'cart-icon-bubble' 70 } 71 ]; 72 } 73 74 getSectionInnerHTML(html, selector = '.shopify-section') { 75 return new DOMParser() 76 .parseFromString(html, 'text/html') 77 .querySelector(selector).innerHTML; 78 } 79 80 handleBodyClick(evt) { 81 const target = evt.target; 82 if (target !== this.notification && !target.closest('cart-notification')) { 83 const disclosure = target.closest('details-disclosure, header-menu'); 84 this.activeElement = disclosure ? disclosure.querySelector('summary') : null; 85 this.close(); 86 } 87 } 88 89 setActiveElement(element) { 90 this.activeElement = element; 91 } 92} 93 94customElements.define('cart-notification', CartNotification);
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.