我有一个双方的mouseup一个拉斐尔文本元素并单击事件处理程序。如果我更改了mouseup事件处理程序中的文本,则单击事件处理程序不会再被调用。为什么会发生?为什么在拉斐尔更改文本取消事件?
我测试在Chrome,Firefox和Opera下面的代码:
<!doctype html>
<html>
<head>
<script type='text/javascript' src='jquery-1.7.1.js'></script>
<script type='text/javascript' src='raphael-min.js'></script>
<script type='text/javascript'>
window.onload = function() {
var paper = Raphael(document.getElementById('raphael'),500,200);
var text1 = paper.text(100, 20, "Just movin'");
var text2 = paper.text(100, 40, "Hello World");
$(text1.node).mouseup(function() {
text1.attr({"x" : "200"});
console.log("text1 mouseup");
});
$(text1.node).click(function() {
console.log("text1 click"); // Is called
});
$(text2.node).mouseup(function() {
text2.attr({"text": "Goodbye world"});
console.log("text2 mouseup");
});
$(text2.node).click(function() {
console.log("text2 click"); // Is not called
});
}
</script>
</head>
<body>
<div id="raphael"></div>
</body>
</html>
这可能是你使用jQuery和Dom而不是SVG DOM进行交流,我现在在iPod上测试这个问题 – Chasbeen 2012-03-27 21:49:31