Merge pull request #215 from AMoo-Miki/main

Add `.x` suffix to versions selector
This commit is contained in:
Miki 2021-10-07 10:22:31 -07:00 committed by GitHub
commit d88cc2e810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -143,10 +143,10 @@ class VersionSelector extends HTMLElement {
const {shadowRoot} = this;
const frag = this._makeFragment(tpl);
frag.querySelector('#selected').textContent = `${PREFIX}${this.getAttribute('selected')}`;
frag.querySelector('#selected').textContent = `${PREFIX}${this.getAttribute('selected')}.x`;
const pathName = location.pathname.replace(/\/docs(\/((latest|\d+\.\d+)\/?)?)?/, '');
const versionsDOMText = DOC_VERSIONS.map((v, idx) => `<a href="/docs/${v}/${pathName}"${idx === 0 ? ' class="latest"' : ''}>${PREFIX}${v}</a>`)
const versionsDOMText = DOC_VERSIONS.map((v, idx) => `<a href="/docs/${v}/${pathName}"${idx === 0 ? ' class="latest"' : ''}>${PREFIX}${v}.x</a>`)
.join('');
frag.querySelector('#dropdown').appendChild(this._makeFragment(versionsDOMText));