This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
The following commit(s) were added to refs/heads/master by this push:
new c54de324 Fix incorrect doc sample.
c54de324 is described below
commit c54de324ddbcaa7b6333fa5f88f20c5bd44518e9
Author: 100pah <[email protected]>
AuthorDate: Fri Oct 24 18:31:34 2025 +0800
Fix incorrect doc sample.
---
en/option/component/toolbox.md | 16 ++++++++--------
en/option/partial/tooltip-common.md | 2 +-
zh/option/component/toolbox.md | 16 ++++++++--------
zh/option/partial/tooltip-common.md | 2 +-
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/en/option/component/toolbox.md b/en/option/component/toolbox.md
index 6cd510f7..85bdaadc 100644
--- a/en/option/component/toolbox.md
+++ b/en/option/component/toolbox.md
@@ -256,16 +256,16 @@ optionToContent: function(opt) {
var axisData = opt.xAxis[0].data;
var series = opt.series;
var table = '<table style="width:100%;text-align:center"><tbody><tr>'
- + '<td>Time:</td>'
- + '<td>' + series[0].name + '</td>'
- + '<td>' + series[1].name + '</td>'
- + '</tr>';
+ + '<td>Time:</td>'
+ + '<td>' + echarts.format.encodeHTML(series[0].name) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[1].name) + '</td>'
+ + '</tr>';
for (var i = 0, l = axisData.length; i < l; i++) {
table += '<tr>'
- + '<td>' + axisData[i] + '</td>'
- + '<td>' + series[0].data[i] + '</td>'
- + '<td>' + series[1].data[i] + '</td>'
- + '</tr>';
+ + '<td>' + echarts.format.encodeHTML(axisData[i]) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[0].data[i]) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[1].data[i]) + '</td>'
+ + '</tr>';
}
table += '</tbody></table>';
return table;
diff --git a/en/option/partial/tooltip-common.md
b/en/option/partial/tooltip-common.md
index 3237b0c8..33b0856f 100644
--- a/en/option/partial/tooltip-common.md
+++ b/en/option/partial/tooltip-common.md
@@ -325,7 +325,7 @@ The format of callback function:
// if `name` or `value` come from untrusted sources, where
// malicious code may be injected into that strings.
return echarts.format.encodeHTML(name)
- + '<b>' + echarts.format.encodeHTML(value + '') + '</b>';
+ + '<b>' + echarts.format.encodeHTML(value) + '</b>';
// NOTE: `echarts.format.encodeHTML` is an utility that converts
special
// characters ('&', '<', '>', '"', "'") to their corresponding
HTML entities.
// This is just an example -- any HTML-escaping utility can be
used.
diff --git a/zh/option/component/toolbox.md b/zh/option/component/toolbox.md
index 12cb25fb..054c8bde 100644
--- a/zh/option/component/toolbox.md
+++ b/zh/option/component/toolbox.md
@@ -329,16 +329,16 @@ optionToContent: function(opt) {
var axisData = opt.xAxis[0].data;
var series = opt.series;
var table = '<table style="width:100%;text-align:center"><tbody><tr>'
- + '<td>时间</td>'
- + '<td>' + series[0].name + '</td>'
- + '<td>' + series[1].name + '</td>'
- + '</tr>';
+ + '<td>时间</td>'
+ + '<td>' + echarts.format.encodeHTML(series[0].name) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[1].name) + '</td>'
+ + '</tr>';
for (var i = 0, l = axisData.length; i < l; i++) {
table += '<tr>'
- + '<td>' + axisData[i] + '</td>'
- + '<td>' + series[0].data[i] + '</td>'
- + '<td>' + series[1].data[i] + '</td>'
- + '</tr>';
+ + '<td>' + echarts.format.encodeHTML(axisData[i]) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[0].data[i]) + '</td>'
+ + '<td>' + echarts.format.encodeHTML(series[1].data[i]) + '</td>'
+ + '</tr>';
}
table += '</tbody></table>';
return table;
diff --git a/zh/option/partial/tooltip-common.md
b/zh/option/partial/tooltip-common.md
index 0f63ed22..0bd352ed 100644
--- a/zh/option/partial/tooltip-common.md
+++ b/zh/option/partial/tooltip-common.md
@@ -332,7 +332,7 @@ formatter: '{b0}: {c0}<br />{b1}: {c1}'
// 同时,如果 name 或 value 的值来自于“非受信任”的来源,则可能被注入恶意代码;
// 如果未被转义,则会被运行。
return echarts.format.encodeHTML(name)
- + '<b>' + echarts.format.encodeHTML(value + '') + '</b>';
+ + '<b>' + echarts.format.encodeHTML(value) + '</b>';
// 注:`echarts.format.encodeHTML` 是个工具函数,把特殊字符
// ('&'、'<'、'>'、'"'、"'")转换成他们对应的 HTML entities.
// 这只是个例子,任何 HTML 转义工具函数都可使用。
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]