SVG支持多少级别的递归? [英] How many levels of recursion does SVG support?
问题描述
我不能超过2个等级. (已在Iceweasel和Chromium上试用过.)
I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)
作为测试,我尝试了此先前答复中提供的代码的变体.该文件由3个单独的文件组成,其中a.svg
包括b.svg
,而b.svg
包括c.svg
. (注意: 这不是周期.)
As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg
includes b.svg
, and b.svg
includes c.svg
. (NB: This is not a cycle.)
<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>
<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>
<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>
我希望看到一个大的深黄色点,一个中等大小的橙色点和一个小的红色点,但是我只看到前两个.实际上,我看到的内容与b.svg
不包含c.svg
的内容完全相同.
I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg
did not include c.svg
.
为什么不包含c.svg
?
有没有一种方法可以使SVG递归在2个以上的级别上正常工作?
Is there a way to get SVG recursion to work for more than 2 levels?
推荐答案
SVG用作图像时,必须在单个文件中完整.
SVG when used as an image must be complete in a single file.
- a.svg不是图像
- b.svg被a.svg包含为图像,因此受单个文件图像规则中完整的规则的约束,因此它包含的所有图像都必须作为将c.svg转换为数据URI,并将其内嵌在b.svg中以解决此问题.
Convert c.svg to a data URI and include it inline in b.svg to get round this.
这篇关于SVG支持多少级别的递归?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!