Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:2 Changed 11 months 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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
the if condition below breaks, as cur is still null. Had to add another null check before cur.disabled !== true to fix the problem.