mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: use textContent instead of innerText for better perf
This commit is contained in:
parent
4e0bfee44e
commit
d19b84c9ee
1 changed files with 5 additions and 3 deletions
|
|
@ -44,8 +44,9 @@ export function getCurrentBranch(passive = false) {
|
|||
if (branchButtonElement) {
|
||||
const branchNameSpanElement = branchButtonElement.querySelector('span')
|
||||
if (branchNameSpanElement) {
|
||||
const partialBranchNameFromInnerText = branchNameSpanElement.innerText
|
||||
if (!partialBranchNameFromInnerText.includes('…')) return partialBranchNameFromInnerText
|
||||
const partialBranchNameFromInnerText = branchNameSpanElement.textContent || ''
|
||||
if (partialBranchNameFromInnerText && !partialBranchNameFromInnerText.includes('…'))
|
||||
return partialBranchNameFromInnerText
|
||||
}
|
||||
const defaultTitle = 'Switch branches or tags'
|
||||
const title = branchButtonElement.title.trim()
|
||||
|
|
@ -242,7 +243,8 @@ export function getPath() {
|
|||
if (!pathElement?.querySelector('.js-repo-root')) {
|
||||
return []
|
||||
}
|
||||
const path = ((pathElement as HTMLDivElement).innerText || '')
|
||||
const path = ((pathElement as HTMLDivElement).textContent || '')
|
||||
.trim()
|
||||
.replace(/ \/ Jump to $/, '')
|
||||
.trim()
|
||||
.split('/')
|
||||
|
|
|
|||
Loading…
Reference in a new issue