0
我正在使用jQuery 1.3.2,并试图选择svg DOM元素中的某些元素。jQuery不会选择lineargradient对象
$('svg > defs > lineargradient')
但是由于某种原因,它不选择它,我知道我可以访问其他的项目在<SVG>因素,因为我已经成功地检索到$(“SVG>矩形”)。
我的SVG DOM看起来是这样的:
<svg width="975" height="385">
<defs>
<lineargradient id="raphael-gradient-0" x1="1.000" y1="1.000" x2="0.000" y2="0.000">
<stop offset="0%" stop-color="#242b62"/><stop offset="9.090909090909092%" stop-color="#174a88"/>
<stop offset="18.181818181818183%" stop-color="#0e60a3"/><stop offset="27.272727272727273%" stop-color="#0b66ab"/>
<stop offset="36.36363636363637%" stop-color="#0870b7"/>
...
</lineargradient>
<lineargradient id="raphael-gradient-1" x1="1.000" y1="1.000" x2="0.000" y2="0.000">...</lineargradient>
</defs>
<circle cx="50" cy="40" r="10" fill="#ff0000" stroke="#000" transform=""/>
<rect x="0" y="0" width="975" height="385" fill="url(#raphael-gradient-1)" stroke="none" transform="" style="opacity: 1;" opacity="1" fill-opacity="1"/>
</svg>
有任何理由的jQuery 1.3.2将无法选择<的LinearGradient >元素?
嗯有趣,这似乎没有在Internet Explorer中工作。 – leeand00 2009-09-18 15:54:33
它表示IE8上“线性渐变为0”的数量。 – leeand00 2009-09-18 15:56:09
@ leeand00 - 这是上周的两倍,我因为没有在IE上测试而被抓到(通常使用Firefox)。这与jQuery使用的Sizzle Selector引擎有关。 – 2009-09-18 15:58:56