mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
web: Convert .data("code-language") to .attr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
c2bae4c9d9
commit
abee323c77
@@ -98,9 +98,11 @@ function register_click_handlers(): void {
|
|||||||
const $view_in_playground_button = $(this);
|
const $view_in_playground_button = $(this);
|
||||||
const $codehilite_div = $(this).closest(".codehilite");
|
const $codehilite_div = $(this).closest(".codehilite");
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const playground_info = realm_playground.get_playground_info_for_languages(
|
const language = $codehilite_div.attr("data-code-language");
|
||||||
$codehilite_div.data("code-language"),
|
if (language === undefined) {
|
||||||
);
|
return;
|
||||||
|
}
|
||||||
|
const playground_info = realm_playground.get_playground_info_for_languages(language);
|
||||||
if (playground_info === undefined) {
|
if (playground_info === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ export const update_elements = ($content: JQuery): void => {
|
|||||||
$content.find("div.codehilite").each(function (): void {
|
$content.find("div.codehilite").each(function (): void {
|
||||||
const $codehilite = $(this);
|
const $codehilite = $(this);
|
||||||
const $pre = $codehilite.find("pre");
|
const $pre = $codehilite.find("pre");
|
||||||
const fenced_code_lang = $codehilite.data("code-language");
|
const fenced_code_lang = $codehilite.attr("data-code-language");
|
||||||
let playground_info;
|
let playground_info;
|
||||||
if (fenced_code_lang !== undefined) {
|
if (fenced_code_lang !== undefined) {
|
||||||
playground_info = realm_playground.get_playground_info_for_languages(fenced_code_lang);
|
playground_info = realm_playground.get_playground_info_for_languages(fenced_code_lang);
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ function test_code_playground(mock_template, viewing_code) {
|
|||||||
$content.set_find_results("div.codehilite", $array([$hilite]));
|
$content.set_find_results("div.codehilite", $array([$hilite]));
|
||||||
$hilite.set_find_results("pre", $pre);
|
$hilite.set_find_results("pre", $pre);
|
||||||
|
|
||||||
$hilite.data("code-language", "javascript");
|
$hilite.attr("data-code-language", "javascript");
|
||||||
|
|
||||||
const $code_buttons_container = $.create("code_buttons_container", {
|
const $code_buttons_container = $.create("code_buttons_container", {
|
||||||
children: ["copy-code-stub", "view-code-stub"],
|
children: ["copy-code-stub", "view-code-stub"],
|
||||||
|
|||||||
Reference in New Issue
Block a user