为什么Chrome会从style属性读取svg circle的半径? [英] Why does Chrome read the svg circle radius from the style attribute?

查看:299
本文介绍了为什么Chrome会从style属性读取svg circle的半径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用chrome开发工具进行开发。

我只是用IE11进行了演示。是的,我的错误是没有使用IE进行检查,下面的语法并没有打算(在d3.js中设置属性时出错)。但是我很伤心,因为我的图表没有显示,我想了解为什么我以前无法赶上错误...



下面的代码片段在Chrome浏览器中,不在IE11中。

-code>

< 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆