Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#10078 closed bug (invalid)

Binding to change event nulls event object in IE9

Reported by: neil.martin@… Owned by: neil.martin@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

Description

Firstly, here's the scenario:

  • an ASP.net 3.5 web form with standard ASP.net validation
  • jQuery 1.6.2
  • a custom 'change' event handler that is bound to a textarea on the form:

$("textarea").bind("change keyup keydown", function() {

Monitor character count

}).trigger("change");

If using IE9, the internal ASP.net validation script throws the following error:

SCRIPT5007: Unable to get value of the property 'srcElement': object is null or undefined WebResource.axd?d=W-BIdqaeNBPdzou...

against the following lines of script:

if (!event) {

event = window.event;

} var targetedControl; if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {

targetedControl = event.srcElement;

}

... }

The problem did/does not exist with jQuery 1.5.2

I don't think the problem is related to the ASP.net validation per se, it just happens to be the scenario that exposed the problem.

It 'appears' that in binding to the change event, IE somehow nulls the/loses reference to the window.event object - but my debugging skills are not sufficient to determine this - sorry.

Change History (3)

comment:1 Changed 7 years ago by dmethvin

Owner: set to neil.martin@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket! Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, we've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.

comment:2 Changed 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:3 Changed 6 years ago by brucea@…

I am having the exact same problem as described by this ticket. It is occuring only in IE9 --

I identified the same code cited in the original ticket above as the culprit. We are using jQuery 1.8.3.

As per above, the actual code that fails is in the ScriptResources.axd file and the method argument (event) is null. So javascript errors out and no additional javascript is executed.

Note: See TracTickets for help on using tickets.