Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

autogrow._handleShow should only bind to browser's transition end event (memory leak) #6697

Closed
nonplus opened this Issue · 2 comments

3 participants

@nonplus

Right now, the autoshow._handleShow() function binds once to three flavors of the transition end event: one("transitionend webkitTransitionEnd oTransitionEnd"). Since a browser is only going to fire (at most) one of these events (IE will fire none of them), the other event subscriptions won't ever be released.

The following code is the culprit:

if ( event.type !== "popupbeforeposition" ) {
    this.element
        .addClass( "ui-textinput-autogrow-resize" )
        .one( "transitionend webkitTransitionEnd oTransitionEnd",
            $.proxy( function() {
                this.element.removeClass( "ui-textinput-autogrow-resize" );
            }, this ) );
}

The fix should be to bind to the specific transition end event (if the browser has one). For example, the following is an example of a fixed implementation:

var transitionEndEvent = 'WebkitTransition' in window ? 'webkitTransitionEnd'
    : 'OTransition' in window ? 'oTransitionEnd'
    : 'MozTransition' in window || 'transition' in window ? 'transitionend'
    : undefined;

if ( event.type !== "popupbeforeposition" && transitionEndEvent) {
    this.element
        .addClass( "ui-textinput-autogrow-resize" )
        .one( "transitionend webkitTransitionEnd oTransitionEnd",
            $.proxy( function() {
                this.element.removeClass( "ui-textinput-autogrow-resize" );
            }, this ) );
}

However, there is probably a better place to configure the transitionEndEvent variable so that it can be reused by other widgets (e.g. panel.js)

@gabrielschulhof
Collaborator

$.support might be a good place for storing the value of that conditional.

@nonplus

I assume you mean $.mobile.support. I'm not sure what the correct naming conventions are and it seems that most of the support properties are Boolean rather than string values (though since an event name is truthy, that shouldn't be a problem).

In this case, would the name be $.mobile.support.transition.end?

@arschmitz arschmitz was assigned
@arschmitz arschmitz referenced this issue from a commit
@arschmitz arschmitz AnimationComplete: Add transition, fallbacks and remove memory leaks
Also no its own module including support tests for animations and
transitions

Fixes gh-5156
Fixes gh-6816
Fixes gh-6697
Fixes gh-6895
Fixes gh-6148
f4fbff2
@arschmitz arschmitz referenced this issue from a commit
@arschmitz arschmitz AnimationComplete: Add transition, fallbacks and remove memory leaks
Also no its own module including support tests for animations and
transitions

Fixes gh-5156
Fixes gh-6816
Fixes gh-6697
Fixes gh-6895
Fixes gh-6148
Closes gh-7001
0793219
@arschmitz arschmitz referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@arschmitz arschmitz closed this issue from a commit
@arschmitz arschmitz AnimationComplete: Add transition, fallbacks and remove memory leaks
Also no its own module including support tests for animations and
transitions

Fixes gh-5156
Fixes gh-6816
Fixes gh-6697
Fixes gh-6895
Fixes gh-6148
Closes gh-7001
749c78e
@arschmitz arschmitz closed this in 749c78e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.