Sunday, 25 August 2013

javascript event object target field has different value than event.target

javascript event object target field has different value than event.target

Why is it that the event object (e) returned to the jquery callback
contains "target" field with a value of ({}), but yields an url
("http://www.myurl.com") when logged as e.target?
Shouldn't the "target" field contain the same value as e.target? How does
it work? I'm confused.
$('.ckfilter').click(function(e){
e.preventDefault();
console.log("e:",e);
console.log("e.target:",e.target);
});
e:
({originalEvent:({}),
type:"click",
isDefaultPrevented:function K() {return !0;},
timeStamp:22619729,
jQuery172031920598426947033:true,
toElement:(void 0),
screenY:328,
screenX:674,
pageY:204,
pageX:154,
offsetY:(void 0),
offsetX:(void 0),
fromElement:(void 0),
clientY:204,
clientX:154,
buttons:1,
button:0,
which:1,
view:({}),
target:({}),
shiftKey:false,
relatedTarget:null,
metaKey:false,
eventPhase:3,
currentTarget:({}),
ctrlKey:false,
cancelable:true,
bubbles:true,
altKey:false,
srcElement:(void 0),
relatedNode:(void 0),
attrName:(void 0),
attrChange:(void 0),
delegateTarget:({}),
data:null,
handleObj:{type:"click",
origType:"click",
data:null,
handler:(function (e) {e.preventDefault(); }),
guid:18,
selector:null,
quick:null,
namespace:""}
})
e.target: "http://www.myurl.com"

No comments:

Post a Comment