Side navigation
#13255 closed bug (fixed)
Opened January 17, 2013 07:30PM UTC
Closed May 02, 2013 05:43PM UTC
jQuery 2.0b1 and Cordova 2.3.0 cause "Uncaught TypeError: Cannot read property 'nodeType' of null".
Reported by: | rahmadi_deswira@yahoo.com | Owned by: | dmethvin |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.1 |
Component: | event | Version: | 2.0b1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery 2.0b1 and Cordova 2.3.0 cause "Uncaught TypeError: Cannot read property 'nodeType' of null".
Sorry I cannot provide test case on jsbin because the code requires cordova-2.3.0.js (BlackBerry version) and must run on Ripple emulator (Google Chrome extension), however the code is quite short:
<!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <script src="http://code.jquery.com/jquery-2.0.0b1.js"></script> <script src="cordova-2.3.0.js"></script> </head> <body> <script> // NOTE: Run on Ripple emulator 0.9.12 $(document).on("deviceready", function() { console.log("on deviceready"); }); </script> </body> </html>
Information:
-jQuery version affected: 2.0b1.
-Browser: Google Chrome 23.0.1271.97 + Ripple emulator 0.9.12 (extension).
-OS: Windows 7 x64.
-Other jQuery version tested: 1.9.0, runs fine (no error).
-Ripple emulator settings: On "Devices" selection, please choose "BlackBerry Bold 9700".
Attachments (0)
Change History (15)
Changed January 20, 2013 05:43PM UTC by comment:1
owner: | → rahmadi_deswira@yahoo.com |
---|---|
status: | new → pending |
Changed January 21, 2013 02:34PM UTC by comment:2
status: | pending → new |
---|
The error is on line 2760 of jquery-2.0.0b1.js. Here is the console output:
Uncaught TypeError: Cannot read property 'nodeType' of null...jquery-2.0.0b1.js:2760 ..jQuery.event.fix............................................jquery-2.0.0b1.js:2760 ..jQuery.event.dispatch.......................................jquery-2.0.0b1.js:2593 ..elemData.handle.............................................jquery-2.0.0b1.js:2316 ..Channel.fire................................................cordova-2.3.0.js:690 ..(anonymous function)........................................cordova-2.3.0.js:219
Note: I already tested the code on a real BlackBerry simulator OS 7.0 (not Ripple), no luck. Run fine on jQuery 1.9.0, but error on jQuery 2.0.0b1.
Please let me know if you need any other information. Thanks.
Replying to [comment:1 dmethvin]:
Can you provide some more information about the failure? I'm not familiar with this emulator, and it could well be a bug in the emulator. What version of Blackberry OS does it run? Is there any other debugging information about the location of the error?
Changed February 12, 2013 03:15AM UTC by comment:3
resolution: | → notabug |
---|---|
status: | new → closed |
If I'm reading the stack trace correctly, it looks like the cordova-2.3.0.js script is not setting an event target, but the real browser does. If that's the case it should be reported to them.
Changed April 08, 2013 11:02PM UTC by comment:4
Need to reopen this bug.
The deviceready event has its target set to null and we are trying to check event.target.nodeType without checking if target actually exists as an object.
Is it really necessary to attach an application file to prove that jquery is breaking in cordova? Checking for event.target && event.target.nodeType in jQuery.event.fix fixes the problem.
This doesn't break in a desktop browser because the deviceready event doesn't fire on desktop.
Changed April 09, 2013 12:00AM UTC by comment:5
Did you try your test with beta 2, or with jquery-git2.js which is the latest 2.0 pre-beta? This sounds similar to something that we fixed long ago. It's hard to tell without code though.
Changed April 09, 2013 06:35PM UTC by comment:6
I had the bug using v2.0.0b2, Date: 2013-3-1.
Changed April 09, 2013 06:37PM UTC by comment:7
Does http://code.jquery.com/jquery-2.0.0-beta3.js fail as well?
Changed April 09, 2013 06:58PM UTC by comment:8
Yes, still breaks.
Throws at line 4775:
if ( event.target.nodeType === 3 )
Checking for target first fixes the issue.
Changed April 09, 2013 08:23PM UTC by comment:9
component: | unfiled → event |
---|---|
milestone: | None → 2.0 |
priority: | undecided → blocker |
resolution: | notabug |
status: | closed → reopened |
I just want to confirm: This is not a problem on real hardware, and only occurs on the emulator?
Changed April 10, 2013 08:25AM UTC by comment:10
No, it breaks on real devices too. Tested on android 2.3.
Changed April 19, 2013 12:23AM UTC by comment:11
I guess this bug fix didn't make it into 2.0?
Changed April 19, 2013 12:45AM UTC by comment:12
milestone: | 2.0 → 2.0.1 |
---|---|
status: | reopened → open |
Sorry, no it did not. I reopened it but didn't then mark it open so it didn't show up in the report.
Changed April 29, 2013 03:21PM UTC by comment:13
owner: | rahmadi_deswira@yahoo.com → dmethvin |
---|---|
status: | open → assigned |
Changed May 01, 2013 12:54AM UTC by comment:14
I confirm that this happens on iPhone and Android as well with cordova 2.5.0 version. It prevents the deviceready event from firing on mobiles with jquery 2.0.0 final. Adding the test to even.target on line 4757 does fix the issue i.e. if (event.target && event.target.nodeType === 3 ).
Changed May 02, 2013 05:43PM UTC by comment:15
resolution: | → fixed |
---|---|
status: | assigned → closed |
Fix #13255. Set a default event target for Cordova.
Changeset: 6b5391508e7354076a32375c7f536f8eb91195ee
Can you provide some more information about the failure? I'm not familiar with this emulator, and it could well be a bug in the emulator. What version of Blackberry OS does it run? Is there any other debugging information about the location of the error?