#13173 closed bug (notabug)
isTrigger on Internet Explorer
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
As you can see at http://jsfiddle.net/tomasdev/bZNLB/
On IE7 and IE8 (haven't tested IE9), when the user clicks the input the evt.isTrigger property on change event is assigned with a true
value.
This is inconsistent with other browsers, since it's a real user click and not a jQuery triggered event.
I think it's quite a high bug. May be happening for other events, may be due to IE engine assigning that variable on the event. I dont know what to suggest as fix, making a backwards compatible version.
Change History (5)
comment:1 follow-up: 3 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Status: | pending → new |
---|
I was looking at it in order to check whether the event was caused by a manual .trigger() or was a user interaction consequence.
Now I'm using !!evt.originalEvent in order to create a flag where to check if it's native user interaction or not.
What method would you recommend?
comment:3 Changed 10 years ago by
Replying to dmethvin:
Why are you looking at
.isTrigger
? It is not documented. Do not use it.IE doesn't fire a change event when you click a checkbox. We have to fire one for you.
By the way, it's pretty interesting that a lot of users are using that .isTrigger to check what I wanted. You can check out at most used knowledge bases such as Stack Overflow.
So this ticket is useful for whoever finds it, it's a write down of what's happening. We should not use undocumented methods/properties/etc.
comment:4 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
When you trigger an event manually you can pass data, so you could do something like this:
$("#checkbox").on("change", function( event, mydata ) { if ( mydata ) { console.log("called by trigger"); } else { console.log("NOT called by trigger"); } }); $("#checkbox").trigger("change", [ true ]);
By the way, it's pretty interesting that a lot of users are using that .isTrigger to check what I wanted. You can check out at most used knowledge bases such as Stack Overflow.
If it's not documented, it may break in the future.
comment:5 Changed 10 years ago by
BTW I highly do not recommend using custom data in events to check if it's user event or not, since not all implementations across jQuery developers are using that. So there's no guarantee that anyone won't trigger without that useful relying-onto data.
Why are you looking at
.isTrigger
? It is not documented. Do not use it.IE doesn't fire a change event when you click a checkbox. We have to fire one for you.