Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11933 closed bug (invalid)

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")){
...
}

Change History (4)

comment:1 Changed 7 years ago by tranbbt

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.

comment:2 Changed 7 years ago by tranbbt

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.

comment:3 Changed 7 years ago by dmethvin

Resolution: invalid
Status: newclosed

comment:4 Changed 7 years ago by anonymous

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

Note: See TracTickets for help on using tickets.