返回值:Booleanevent.isPropagationStopped()
V1.3概述
æ ¹æ�®äº‹ä»¶å¯¹è±¡ä¸æ˜¯å�¦è°ƒç”¨è¿‡ event.stopPropagation() 方法æ�¥è¿”回一个布尔值。
这个事件方法在 W3C DOM Level 3 specification 有介�。
示例
�述:
检测 event.stopPropagation() 是�被调用过。
代ç �:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<button>click me</button>
<div id="stop-log"></div>
<script>
function propStopped(e) {
var msg = "";
if ( e.isPropagationStopped() ) {
msg = "called";
} else {
msg = "not called";
}
$("#stop-log").append( "<div>" + msg + "</div>" );
}
$("button").click(function(event) {
propStopped(event);
event.stopPropagation();
propStopped(event);
});
</script>
</body>
</html>