jquery-form / jquery-form/form

.selector property is removed

Open
#353 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
JavaScript
Stars
5.1k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

http://jquery.com/upgrade-guide/1.9/#selector-property-on-jquery-objects

As of 1.9, the .selector property is gone.
Looks like it is still hanging around in in ajaxForm.
Unless I am reading this wrong, .selector needs to be dealt with.

$.fn.ajaxForm = function(options) {
options = options || {};
options.delegation = options.delegation && $.isFunction($.fn.on);

// in jQuery 1.3+ we can fix mistakes with the ready state
if (!options.delegation && this.length === 0) {
    var o = { s: this.selector, c: this.context };
    if (!$.isReady && o.s) {
        log('DOM not ready, queuing ajaxForm');
        $(function() {
            $(o.s,o.c).ajaxForm(options);
        });
        return this;
    }
    // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
    log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
    return this;
}

if ( options.delegation ) {
    $(document)
        .off('submit.form-plugin', this.selector, doAjaxSubmit)
        .off('click.form-plugin', this.selector, captureSubmittingElement)
        .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
        .on('click.form-plugin', this.selector, options, captureSubmittingElement);
    return this;
}

return this.ajaxFormUnbind()
    .bind('submit.form-plugin', options, doAjaxSubmit)
    .bind('click.form-plugin', options, captureSubmittingElement);

};

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the $.fn.ajaxForm entry point shown in the issue and read the jQuery 1.9 upgrade-guide section on the removed .selector property. Trace both the zero-element ready-state path and the delegation event bindings. Done means ajaxForm no longer depends on .selector while preserving the reported behavior, with the relevant existing tests or examples passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.