1import { CustomElement } from './custom-element.js' 2 3 4export class ScrollNav extends CustomElement { 5 connectedCallback() { 6 this.role = 'nav' 7 8 if (this.scrollWidth > this.clientWidth) { 9 const list = this.querySelector('ul'); 10 const selected = list.querySelector('.selected') 11 const offset = (selected.offsetLeft + selected.offsetWidth / 2) 12 - this.offsetWidth / 2 13 14 this.scrollTo(offset, 0) 15 } 16 } 17} 18 19customElements.define('tpy-scroll-nav', ScrollNav)
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.