如何在 SVG 中进行块注释
我第一次尝试学习 SVG,但代码似乎与我的块注释有问题。我正在使用:
/* This is my
* block comment
*/
当我运行代码时,出现以下错误:
'return' statement outside of function
line: 116, column: 4
这恰好发生在我的块注释之前。
I'm trying to learn SVG for the first time but the code seems to have an issue with my block comments. I'm using:
/* This is my
* block comment
*/
And when I run my code, I get the following error:
'return' statement outside of function
line: 116, column: 4
That so happens to be immediately before my block comment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于 SVG 是 XML,因此您可以使用 XML 样式注释:
例如:
或者您可以排除代码的某些部分:
As SVG is XML, you can use XML style comments:
For example:
Or you can exclude some part of code:
就 DOM 而言,svg 文档与 html 文档非常相似。
此行将在所有浏览器中中断:
并且可以简单地替换为:
实际上没有真正需要创建变量
svgDocument
因为document
始终被定义并引用当前文档(svg)。请阅读https://jwatt.org/svg/authoring/,特别是https://jwatt.org/svg/authoring/#asv-getters-and-setters。
An svg document is much the same as an html document as far as the DOM is concerned.
This line will break in all browsers:
And could simply be replaced by:
Actually there's no real need to create a variable
svgDocument
sincedocument
is always defined and referring to the current document (the svg).Please read https://jwatt.org/svg/authoring/ and in particular https://jwatt.org/svg/authoring/#asv-getters-and-setters.
您可以使用 xml 标签作为“desc”。
You can use a xml tag as "desc".