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

        Wouter created issue -
        Wouter made changes -
        Field Original Value New Value
        Attachment index.html [ 12526329 ]
        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 -
        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.
        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 ]
        Filip Maj made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development