@vaadin-component-factory/vcf-nav
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@vaadin-component-factory/vcf-nav", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"homepage": "https://github.com/vaadin-component-factory/vcf-nav", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/vaadin-component-factory/vcf-nav", |
@@ -162,2 +162,5 @@ import { html, css, LitElement } from 'lit'; | ||
color: var(--lumo-contrast-60pct); | ||
font-size: var(--lumo-icon-size-s); | ||
min-width: 1em; | ||
min-height: 1em; | ||
} | ||
@@ -214,9 +217,14 @@ | ||
_updateActive() { | ||
const pathRelativeToRoot = document.location.pathname; | ||
const basePath = new URL(document.baseURI).pathname; | ||
const pathWithoutBase = pathRelativeToRoot.substring(basePath.length); | ||
const pathRelativeToBase = (basePath !== pathRelativeToRoot && pathRelativeToRoot.startsWith(basePath)) ? pathWithoutBase : pathRelativeToRoot; | ||
this.active = pathRelativeToBase === this.path; | ||
const hasBaseUri = (document.baseURI != document.location.href); | ||
const pathAbsolute = this.path.startsWith("/"); | ||
if (hasBaseUri && !pathAbsolute) { | ||
const pathRelativeToRoot = document.location.pathname; | ||
const basePath = new URL(document.baseURI).pathname; | ||
const pathWithoutBase = pathRelativeToRoot.substring(basePath.length); | ||
const pathRelativeToBase = (basePath !== pathRelativeToRoot && pathRelativeToRoot.startsWith(basePath)) ? pathWithoutBase : pathRelativeToRoot; | ||
this.active = pathRelativeToBase === this.path; | ||
} else { | ||
// Absolute path or no base uri in use. No special comparison needed | ||
this.active = document.location.pathname == this.path; | ||
} | ||
this.toggleAttribute('child-active', document.location.pathname.startsWith(this.path)); | ||
@@ -223,0 +231,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21644
319