Apache Cordova
  1. Apache Cordova
  2. CB-683

Pause and resume events are fired without event parameter

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.1, 1.7.0
    • Fix Version/s: 1.8.0
    • Component/s: CordovaJS
    • Labels:
      None
    • Environment:

      Samsung Galaxy S plus (GT-I9001), HTC Desire (htc_bravo), iPhone

      Description

      The pause and resume events do not pass an event object to the event handlers. This event parameter is not optional according to W3C DOM specification (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration) and expected by for instance jquery.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        13h 27m 1 Filip Maj 11/May/12 01:03
        Hide
        Filip Maj added a comment -

        Good catch! As of commit 55e46c, it does!

        Show
        Filip Maj added a comment - Good catch! As of commit 55e46c , it does!
        Hide
        Wouter added a comment -

        Wow, quick fix, thank you.

        I noticed that the same issue also applies to the deviceready event, does your fix solve that one as well?

        Show
        Wouter added a comment - Wow, quick fix, thank you. I noticed that the same issue also applies to the deviceready event, does your fix solve that one as well?
        Filip Maj made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Filip Maj added a comment -

        For Android, as of commit 6a628f, this is fixed.

        For iOS, as of commit 0a4dbf, this is fixed.

        Also, looks like WP7 had this issue. As of commit 9c1c36 in the JS, this is fixed too.

        Show
        Filip Maj added a comment - For Android, as of commit 6a628f , this is fixed. For iOS, as of commit 0a4dbf , this is fixed. Also, looks like WP7 had this issue. As of commit 9c1c36 in the JS , this is fixed too.
        Filip Maj made changes -
        Assignee Joe Bowser [ bowserj ] Filip Maj [ filmaj ]
        Fix Version/s 1.8.0 [ 12319550 ]
        Priority Major [ 3 ] Minor [ 4 ]
        Component/s CordovaJS [ 12317202 ]
        Component/s iOS [ 12316400 ]
        Component/s Android [ 12316401 ]
        Hide
        Filip Maj added a comment -

        Will fix in 1.8. This is not a native platform issue but rather a cordova-js issue.

        Show
        Filip Maj added a comment - Will fix in 1.8. This is not a native platform issue but rather a cordova-js issue.
        Wouter made changes -
        Summary Pause and resume events on Android are fired without event parameter Pause and resume events are fired without event parameter
        Description The pause and resume events do not pass an event object to the event handlers. This event parameter is not optional according to W3C DOM specification (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration) and expected by for instance jquery.

        Using jquery to bind the event:
        $(document).bind('pause', handler);
        will cause an exception (on Android) since jquery will internally request properties of the event parameter.
        On iOS there will be no exception since iOS supplies a window.event property which jQuery uses when no event parameter is present.

        A workaround is not to use jquery but simply:
        document.addEventListener('pause', handler, false);
        The event handler should not be expecting an event parameter in this case, for both Android and iOS.
        The pause and resume events do not pass an event object to the event handlers. This event parameter is not optional according to W3C DOM specification (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration) and expected by for instance jquery.
        Hide
        Wouter added a comment -

        Using jquery to bind the event:
        $(document).bind('pause', handler);
        will cause an exception on Android since jquery will internally request properties of the event parameter.
        On iOS there will be no exception since iOS supplies a window.event property which jQuery uses when no event parameter is present.

        A workaround is not to use jquery but simply:
        document.addEventListener('pause', handler, false);
        The event handler should not be expecting an event parameter in this case, for both Android and iOS.

        Show
        Wouter added a comment - Using jquery to bind the event: $(document).bind('pause', handler); will cause an exception on Android since jquery will internally request properties of the event parameter. On iOS there will be no exception since iOS supplies a window.event property which jQuery uses when no event parameter is present. A workaround is not to use jquery but simply: document.addEventListener('pause', handler, false); The event handler should not be expecting an event parameter in this case, for both Android and iOS.
        Wouter made changes -
        Environment Samsung Galaxy S plus (GT-I9001), HTC Desire (htc_bravo) Samsung Galaxy S plus (GT-I9001), HTC Desire (htc_bravo), iPhone
        Description The pause and resume events do not pass an event object to the event handlers. This event parameter is not optional according to W3C DOM specification (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration) and expected by for instance jquery.

        Using jquery to bind the event:
        $(document).bind('pause', handler);
        will cause an exception since jquery will internally request properties of the event parameter.

        A workaround is not to use jquery but simply:
        document.addEventListener('pause', handler, false);
        The event handler should not be expecting an event parameter in this case.
        The pause and resume events do not pass an event object to the event handlers. This event parameter is not optional according to W3C DOM specification (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration) and expected by for instance jquery.

        Using jquery to bind the event:
        $(document).bind('pause', handler);
        will cause an exception (on Android) since jquery will internally request properties of the event parameter.
        On iOS there will be no exception since iOS supplies a window.event property which jQuery uses when no event parameter is present.

        A workaround is not to use jquery but simply:
        document.addEventListener('pause', handler, false);
        The event handler should not be expecting an event parameter in this case, for both Android and iOS.
        Component/s iOS [ 12316400 ]
        Wouter made changes -
        Field Original Value New Value
        Attachment index.html [ 12526329 ]
        Hide
        Wouter added a comment -

        Sample file to reproduce this issue.

        Show
        Wouter added a comment - Sample file to reproduce this issue.
        Wouter created issue -

          People

          • Assignee:
            Filip Maj
            Reporter:
            Wouter
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development