Skip to main content

Bug Tracker

Side navigation

#10078 closed bug (invalid)

Opened August 17, 2011 05:27PM UTC

Closed September 02, 2011 07:59AM UTC

Last modified February 26, 2013 10:18PM UTC

Binding to change event nulls event object in IE9

Reported by: neil.martin@abilitation.com Owned by: neil.martin@abilitation.com
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.

Attachments (0)
Change History (3)

Changed August 18, 2011 03:34PM UTC by dmethvin comment:1

owner: → neil.martin@abilitation.com
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.

Changed September 02, 2011 07:59AM UTC by trac-o-bot comment:2

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!

Changed February 26, 2013 10:18PM UTC by brucea@neovi.com comment:3

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.