這個data.target == this
是如何工作的?這段代碼做了什麼? 「data.target == this」
jQuery的例子
.mouseup(function(data, handler)
{
if(data.target == this)
{
// some code
}
})
這是否比較通過比較它們各自的屬性的對象?
我需要這個檢查,因爲我只想在父div和一個孩子上使用mouseup。
if (data.target == this || * if this has className XXX *) {
// some code
}
http://rayfd.wordpress.com/2007/03/18/really-understanding-javascripts-equality-and-identity/ –