You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/07/02 14:20:06 UTC
[incubator-echarts-doc] branch master updated: tweak: use
`document.getElementById` but not `document.querySelector`.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-doc.git
The following commit(s) were added to refs/heads/master by this push:
new ea34d7f tweak: use `document.getElementById` but not `document.querySelector`.
ea34d7f is described below
commit ea34d7fea24edadd35f8f674a3d671b54d892062
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Jul 2 22:19:33 2020 +0800
tweak: use `document.getElementById` but not `document.querySelector`.
Some special characters like `$` are not allowed in selector when using `document.querySelector`,
use `document.getElementById` instead.
The issue is that the doc content page can't scroll to proper position after clicking the option who has such special characters.
Click https://echarts.apache.org/en/option.html#graphic.elements-rect.%24action to reproduce.
---
src/components/DocContent.vue | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/components/DocContent.vue b/src/components/DocContent.vue
index 7441ca8..54b3920 100644
--- a/src/components/DocContent.vue
+++ b/src/components/DocContent.vue
@@ -167,8 +167,10 @@ export default {
if (this.needScrollOffset) {
offset += this.$refs.liveExample.$el.offsetHeight;
}
- // console.log(document.querySelector('#' + convertPathToId(path)), convertPathToId(path));
- scrollIntoView(document.querySelector('#' + convertPathToId(path)), {
+ // previous usage: document.querySelector('#' + convertPathToId(path))
+ // `$` can't exist in selector when using `document.querySelector`,
+ // use `document.getElementById` insead.
+ scrollIntoView(document.getElementById(convertPathToId(path)), {
time: time || 400,
align: {
top: 0,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org