Snap.svg 在这种情况下不起作用:
$('body').append($('<svg>').attr('id', 'test')) ;
console.log($('#test').length) ; // 1
var svg = Snap('#test') ;
svg.circle(100, 100, 50) ;
// Uncaught TypeError: Object [object Object] has no method 'circle'
...但是当元素已经在 HTML 中时有效:
<body>
<svg id="test"></svg>
</body>
SVG 元素在 HTML 中成功,但在 Snap.svg 中找不到。我在第一个示例中做错了还是错误?