为什么Chrome会从style属性读取svg circle的半径? [英] Why does Chrome read the svg circle radius from the style attribute?
问题描述
我只是用IE11进行了演示。是的,我的错误是没有使用IE进行检查,下面的语法并没有打算(在d3.js中设置属性时出错)。但是我很伤心,因为我的图表没有显示,我想了解为什么我以前无法赶上错误...
下面的代码片段在Chrome浏览器中,不在IE11中。
< html>< body>< svg width =120height =120> ;< circle style =fill:rgb(60,60,60); r:20px;cy =30cx =20>< / circle>< / svg>< / body> < / html>
<目前发布的SVG规范版本是 1.1 ,它指出圆的半径是一个属性而不是一个CSS属性。这就是IE所实现的功能。
SVG规范有一个新版本,版本2 。其中,圆的半径(以及其他许多当前属性)将是CSS属性。这就是Chrome所实现的功能。
Chrome正在尝试像Firefox一样实现SVG 2规范的各个部分。不同的UA已经实现了SVG 2规范的不同部分,因为他们在完成SVG 2之前对其进行了研究,证明实现它是可行的。
I develop with chrome dev tools.
I just had a demo with IE11.
Well, yes my mistake for not checking with IE, and the syntax below wasn't intended (made a mistake setting properties in d3.js). But I'm hurt because my graph didn't display, and I want to understand the why I couldn't catch the error earlier...
The snippet below works in Chrome, not in IE11.
<html>
<body>
<svg width="120" height="120">
<circle style="fill: rgb(60,60,60); r: 20px; " cy="30" cx="20"></circle>
</svg>
</body>
</html>
The current published version of the SVG specification is 1.1 it states that the radius of a circle is an attribute and not a CSS property. That's what IE implements.
There is a new version of the SVG specification being worked on, version 2. In it, the radius of a circle (along with many other things that are currently attributes) would be CSS properties. That's what Chrome implements.
Chrome is experimenting with implementing parts of the SVG 2 specification as is Firefox. Different UAs have implemented different parts of the SVG 2 specification as they investigate SVG 2 prior to its completion to prove that it's feasible to implement it.
这篇关于为什么Chrome会从style属性读取svg circle的半径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!