Skip to content

jQuery.when: explore giving .then greater precedence over .promise #2709

@timmywil

Description

@timmywil

See discussion from this PR. Related to #2018.

We currently have

if ( resolveValues[ i ] &&
    jQuery.isFunction( ( method = resolveValues[ i ].promise ) ) ) {

    method.call( resolveValues[ i ] )
        .progress( updateFunc( i, progressContexts, progressValues ) )
        .done( updateFunc( i, resolveContexts, resolveValues ) )
        .fail( master.reject );
} else if ( resolveValues[ i ] &&
    jQuery.isFunction( ( method = resolveValues[ i ].then ) ) ) {

    method.call(
        resolveValues[ i ],
        updateFunc( i, resolveContexts, resolveValues ),
        master.reject,
        updateFunc( i, progressContexts, progressValues )
    );
}

Putting .then before .promise breaks some stuff involving expected contexts and resolved values across multiple Deferreds, but handling Deferreds with .then might still be preferable.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions