Skip to main content

Bug Tracker

Side navigation

#11933 closed bug (invalid)

Opened June 19, 2012 05:58PM UTC

Closed June 23, 2012 01:30PM UTC

Last modified February 24, 2013 06:02PM UTC

IE8 & 9 : Get script error after trigger click() - SCRIPT5007: Unable to get value of the property 'disabled': object is null or undefined

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

In both IE 8 & 9, getting script error below after trigger click().

SCRIPT5007: Unable to get value of the property 'disabled': object is null or undefined

jquery-min.js, line 113 character 246

From the debugger, notice in the f.event dispatcher method, the condition to check whether the target element is disabled, the child attribute "disable" is accessed before checking the parent object is null, in this case c.target was null, therefore calling c.target.disabled gets the error above.

if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){
...
}
Attachments (0)
Change History (4)

Changed June 19, 2012 11:31PM UTC by tranbbt comment:1

Found the uncompressed code, for jquery 1.7.1.

// Determine handlers that should run if there are delegated events
		// Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
		if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {

event.target is null, therefore event.target.disabled gives the error SCRIPT5007: Unable to get value of the property 'disabled': object is null or undefined jquery-min.js, line 113 character 246

I looked in jquery 1.7.2, the same problem exist but the code is different:

// Determine handlers that should run if there are delegated events
		// Avoid non-left-click bubbling in Firefox (#3861)
		if ( delegateCount && !(event.button && event.type === "click") ) {

			// Pregenerate a single jQuery object for reuse with .is()
			jqcur = jQuery(this);
			jqcur.context = this.ownerDocument || this;

			for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process events on disabled elements (#6911, #8165)
				if ( cur.disabled !== true ) {

in the for loop, cur.parentNode is null, if I switch it to

cur = this || cur.parentNode, 

the if condition below breaks, as cur is still null. Had to add another null check before cur.disabled !== true to fix the problem.

Changed June 20, 2012 05:56PM UTC by tranbbt comment:2

After visiting this issue some more, I found that it was caused by using live() to bind events to an object that's not yet exisiting. Replacing using on() or bind() in ready(), Fixed the problem. This problem only happened in IE(8 and 9) browsers.

This ticket can be closed as not a bug.

Changed June 23, 2012 01:30PM UTC by dmethvin comment:3

resolution: → invalid
status: newclosed

Changed February 24, 2013 06:02PM UTC by anonymous comment:4

Try that

Inside your Internet window

In the toolbar, go in Tool

After, go in Internet Options

And inside the tab: Advanced

Than inside the browsing section, take off the X in front of: Display anotification about every script error