Ticket #9941 (closed bug: invalid)
BB 5.0 - jQuery.removeEvent(elem, type, handle) throws java.lang.IllegalArgumentException
| Reported by: | suggsra@… | Owned by: | suggsra@… |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | event | Version: | 1.6.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I am using a Blackberry Simulator:
Blackberry 9550 v 5.0.0.713.
Using jquery 1.6.1
Essentially, I am calling $('selector').remove() on some divs to clear out the dom, and eventually this jQuery.removeEvent(elem, type, handle) causes the Blackberry to throw the IllegalArgumentException. The exception occurs during the elem.removeEventListener( type, handle, false ); execution when the 'handle' parameter is 'undefined'. Maybe all it needs is some null checks. Not a big deal because I have a work-around using some exception handling in the jQuery.cleanData() method.
Thanks!
Change History
comment:1 Changed 22 months ago by rwaldron
- Owner set to rwaldron
- Priority changed from undecided to low
- Status changed from new to assigned
- Component changed from unfiled to event
comment:2 follow-up: ↓ 3 Changed 21 months ago by dmethvin
- Owner changed from rwaldron to suggsra@…
- Status changed from assigned to pending
The error message sounds like a Java (not JavaScript) problem so it's a bit puzzling. I know it's a Blackberry but can you link us to a simple test case showing the problem?
comment:3 in reply to: ↑ 2 Changed 21 months ago by suggsra@…
- Status changed from pending to new
Replying to dmethvin:
The error message sounds like a Java (not JavaScript) problem so it's a bit puzzling. I know it's a Blackberry but can you link us to a simple test case showing the problem?
It is a java problem, it appears to be an unhandled case of undefined parameters to the document.removeEventListener( type, handle, false ) of the blackberry browser, which is used by the jquery library. I'm asking for jquery to handle the exception just the same as it handles inconsistencies across other browsers.
Here is a jsfiddle showing the issue:
http://jsfiddle.net/eatF9/7/show/
Here is a screen shot of me viewing the error on a blackberry simulator:
comment:4 Changed 21 months ago by rwaldron
- Owner changed from suggsra@… to rwaldron
- Status changed from new to assigned
- Milestone changed from None to 1.7
After discussing this with the jQuery Mobile devs, I'm going to suggest we fix it, as BB5 still has a notable market presence.
comment:5 follow-up: ↓ 6 Changed 20 months ago by dmethvin
- Owner changed from rwaldron to suggsra@…
- Status changed from assigned to pending
That test case isn't an example of jQuery doing something wrong though. We need an example of jQuery code that would elicit that problem, not some non-jQuery code that clearly forces undefined as arguments. Can you provide a reduced test case?
comment:6 in reply to: ↑ 5 Changed 20 months ago by suggsra@…
- Status changed from pending to new
Replying to dmethvin:
That test case isn't an example of jQuery doing something wrong though. We need an example of jQuery code that would elicit that problem, not some non-jQuery code that clearly forces undefined as arguments. Can you provide a reduced test case?
Sure,
http://jsfiddle.net/ricksuggs/eatF9/14/show/
FYI, here's my workaround that just catches the exception and moves on:
(function($){
// XXX: rs - this method overrides jquery's default removeEvent method
// created because there was an issue with clicking the dashboard
// refresh button on BB 5.0, it threw a java.lang.IllegalArgumentException
$.cleanData = function( elems ) {
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
try {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ] && cache[ id ][ internalKey ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
} catch (e) {
// just let the IllegalArgumentExcpetion pass
}
};
})(jQuery);
Screenshot of device simulator throwing exception:
comment:7 Changed 20 months ago by dmethvin
- Status changed from new to pending
Can you check with the latest jQuery Mobile and see if it makes a difference?
comment:8 Changed 20 months ago by suggsra@…
- Status changed from pending to new
dmethvin,
the error still occurs with the latest version of jquery-mobile.
See here:
http://jsfiddle.net/ricksuggs/eatF9/15/show/
Thanks
comment:9 Changed 20 months ago by rwaldron
- Owner changed from suggsra@… to rwaldron
- Status changed from new to assigned
comment:10 Changed 19 months ago by dmethvin
I circled back around and cannot reproduce this in either 1.6.3 or 1.7b2. In Chrome and Firefox I put a conditional breakpoint on handle==null in removeEvent and it never hits.
@suggsra, could you see if the problem is still present in 1.7b2? Could you add some code to removeEvent and run it in your simulator to let us know what event type is causing the error? That might give us some more information.
comment:11 Changed 18 months ago by dmethvin
- Owner changed from rwaldron to suggsra@…
- Status changed from assigned to pending
We need some more information about this problem; see above.
comment:13 Changed 18 months ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
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!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


