Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Fix unicorn/prefer-text-content.

Anders Kaseorg70a0260ac1bb
diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js
index 8f289c8c0a7..3409a720c72 100644
--- a/frontend_tests/node_tests/input_pill.js
+++ b/frontend_tests/node_tests/input_pill.js
@@ -348,7 +348,7 @@ run_test("Enter key with text", () => {
preventDefault: noop,
stopPropagation: noop,
target: {
- innerText: " yellow ",
+ textContent: " yellow ",
},
});
@@ -407,7 +407,7 @@ run_test("insert_remove", () => {
key_handler({
keyCode: BACKSPACE,
target: {
- innerText: "",
+ textContent: "",
},
preventDefault: noop,
});
diff --git a/frontend_tests/puppeteer_lib/common.js b/frontend_tests/puppeteer_lib/common.js
index 17261b4afdd..16458c7422e 100644
--- a/frontend_tests/puppeteer_lib/common.js
+++ b/frontend_tests/puppeteer_lib/common.js
@@ -386,7 +386,7 @@ class CommonUtils {
const messages = [];
$.map($el.find(".message_row .message_content"), (message_row) => {
- messages.push(message_row.innerText.trim());
+ messages.push(message_row.textContent.trim());
});
data.push([key, messages]);
diff --git a/frontend_tests/puppeteer_tests/00-realm-creation.js b/frontend_tests/puppeteer_tests/00-realm-creation.js
index ac392993ecd..6f914e8f910 100644
--- a/frontend_tests/puppeteer_tests/00-realm-creation.js
+++ b/frontend_tests/puppeteer_tests/00-realm-creation.js
@@ -27,7 +27,7 @@ async function realm_creation_tests(page) {
await page.goto("http://" + host + "/confirmation_key/");
// Open the confirmation URL
- const page_content = await page.evaluate(() => document.querySelector("body").innerText);
+ const page_content = await page.evaluate(() => document.querySelector("body").textContent);
const confirmation_key = await JSON.parse(page_content).confirmation_key;
const confirmation_url = "http://" + host + "/accounts/do_confirm/" + confirmation_key;
await page.goto(confirmation_url);
@@ -43,7 +43,7 @@ async function realm_creation_tests(page) {
// Make sure the realm creation page is loaded correctly by
// checking the text in <p> tag under pitch class is as expected.
await page.waitForSelector(".pitch");
- const text_in_pitch = await page.evaluate(() => document.querySelector(".pitch p").innerText);
+ const text_in_pitch = await page.evaluate(() => document.querySelector(".pitch p").textContent);
assert(text_in_pitch === "You’re almost there! We just need you to do one last thing.");
// fill the form.
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index c5e3cb4b19f..18f8d2e11f8 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -815,7 +815,7 @@ exports.initialize = function () {
// wrong.
for (let x = 0; x < this.childNodes.length; x += 1) {
if (this.childNodes[x].nodeType !== 3) {
- this.innerText = this.innerText.replace(/\n/, "");
+ this.textContent = this.textContent.replace(/\n/, "");
break;
}
}
diff --git a/static/js/input_pill.js b/static/js/input_pill.js
index 2d05accb3f9..76bf3becfad 100644
--- a/static/js/input_pill.js
+++ b/static/js/input_pill.js
@@ -49,12 +49,12 @@ exports.create = function (opts) {
const funcs = {
// return the value of the contenteditable input form.
value(input_elem) {
- return input_elem.innerText;
+ return input_elem.textContent;
},
// clear the value of the input form.
clear(input_elem) {
- input_elem.innerText = "";
+ input_elem.textContent = "";
},
clear_text() {
diff --git a/static/js/stats/stats.js b/static/js/stats/stats.js
index c9956daf579..553fee7f57e 100644
--- a/static/js/stats/stats.js
+++ b/static/js/stats/stats.js
@@ -180,7 +180,7 @@ function populate_messages_sent_over_time(data) {
function add_hover_handler() {
document.querySelector("#id_messages_sent_over_time").on("plotly_hover", (data) => {
$("#hoverinfo").show();
- document.querySelector("#hover_date").innerText =
+ document.querySelector("#hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null, null];
data.points.forEach((trace) => {
@@ -192,7 +192,7 @@ function populate_messages_sent_over_time(data) {
if (values[i] !== null) {
document.querySelector(hover_text_ids[i]).style.display = "inline";
document.querySelector(hover_value_ids[i]).style.display = "inline";
- document.querySelector(hover_value_ids[i]).innerText = values[i];
+ document.querySelector(hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(hover_text_ids[i]).style.display = "none";
document.querySelector(hover_value_ids[i]).style.display = "none";
@@ -726,7 +726,7 @@ function populate_number_of_users(data) {
function add_hover_handler() {
document.querySelector("#id_number_of_users").on("plotly_hover", (data) => {
$("#users_hover_info").show();
- document.querySelector("#users_hover_date").innerText =
+ document.querySelector("#users_hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null, null];
data.points.forEach((trace) => {
@@ -740,7 +740,7 @@ function populate_number_of_users(data) {
for (let i = 0; i < values.length; i += 1) {
if (values[i] !== null) {
document.querySelector(hover_value_ids[i]).style.display = "inline";
- document.querySelector(hover_value_ids[i]).innerText = values[i];
+ document.querySelector(hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(hover_value_ids[i]).style.display = "none";
}
@@ -859,7 +859,7 @@ function populate_messages_read_over_time(data) {
function add_hover_handler() {
document.querySelector("#id_messages_read_over_time").on("plotly_hover", (data) => {
$("#read_hover_info").show();
- document.querySelector("#read_hover_date").innerText =
+ document.querySelector("#read_hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null];
data.points.forEach((trace) => {
@@ -871,7 +871,7 @@ function populate_messages_read_over_time(data) {
if (values[i] !== null) {
document.querySelector(read_hover_text_ids[i]).style.display = "inline";
document.querySelector(read_hover_value_ids[i]).style.display = "inline";
- document.querySelector(read_hover_value_ids[i]).innerText = values[i];
+ document.querySelector(read_hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(read_hover_text_ids[i]).style.display = "none";
document.querySelector(read_hover_value_ids[i]).style.display = "none";