#9941 closed bug (invalid)
BB 5.0 - jQuery.removeEvent(elem, type, handle) throws java.lang.IllegalArgumentException
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | event | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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 (13)
comment:1 Changed 11 years ago by
Component: | unfiled → event |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → low |
Status: | new → assigned |
comment:2 follow-up: 3 Changed 11 years ago by
Owner: | changed from Rick Waldron to [email protected]… |
---|---|
Status: | assigned → pending |
comment:3 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Milestone: | None → 1.7 |
---|---|
Owner: | changed from [email protected]… to Rick Waldron |
Status: | new → assigned |
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 11 years ago by
Owner: | changed from Rick Waldron to [email protected]… |
---|---|
Status: | assigned → 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 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Status: | new → pending |
---|
Can you check with the latest jQuery Mobile and see if it makes a difference?
comment:8 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Owner: | changed from [email protected]… to Rick Waldron |
---|---|
Status: | new → assigned |
comment:10 Changed 11 years ago by
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 11 years ago by
Owner: | changed from Rick Waldron to [email protected]… |
---|---|
Status: | assigned → pending |
We need some more information about this problem; see above.
comment:12 Changed 11 years ago by
Milestone: | 1.7 → 1.next |
---|
comment:13 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
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!
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?