Replace innerText with textContent

This commit is contained in:
2018-06-28 15:30:24 +09:00
parent 00678cf6a4
commit 050355d8ae
9 changed files with 26 additions and 25 deletions

View File

@ -26,7 +26,7 @@ export function removeAnimeFromCollection(arn: AnimeNotifier, button: HTMLElemen
return
}
button.innerText = "Removing..."
button.textContent = "Removing..."
let {animeId, nick} = button.dataset
let apiEndpoint = arn.findAPIEndpoint(button)

View File

@ -4,7 +4,7 @@ import AnimeNotifier from "../AnimeNotifier"
export function followUser(arn: AnimeNotifier, elem: HTMLElement) {
return arn.post(elem.dataset.api)
.then(() => arn.reloadContent())
.then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").innerText + "."))
.then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").textContent + "."))
.catch(err => arn.statusMessage.showError(err))
}
@ -12,6 +12,6 @@ export function followUser(arn: AnimeNotifier, elem: HTMLElement) {
export function unfollowUser(arn: AnimeNotifier, elem: HTMLElement) {
return arn.post(elem.dataset.api)
.then(() => arn.reloadContent())
.then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").innerText + "."))
.then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").textContent + "."))
.catch(err => arn.statusMessage.showError(err))
}

View File

@ -112,7 +112,7 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, evt?:
searchPageTitle = document.getElementsByTagName("h1")[0]
}
searchPageTitle.innerText = document.title
searchPageTitle.textContent = document.title
if(!term || term.length < 1) {
await arn.innerHTML(searchPage, emptySearchHTML)

View File

@ -4,7 +4,7 @@ import AnimeNotifier from "../AnimeNotifier"
export async function save(arn: AnimeNotifier, input: HTMLElement) {
let obj = {}
let isContentEditable = input.isContentEditable
let value = isContentEditable ? input.innerText : (input as HTMLInputElement).value
let value = isContentEditable ? input.textContent : (input as HTMLInputElement).value
if(value === undefined) {
return
@ -134,8 +134,8 @@ export function increaseEpisode(arn: AnimeNotifier, element: HTMLElement) {
}
let prev = element.previousSibling as HTMLElement
let episodes = parseInt(prev.innerText)
prev.innerText = String(episodes + 1)
let episodes = parseInt(prev.textContent)
prev.textContent = String(episodes + 1)
save(arn, prev)
}