Opened 21 months ago
Last modified 18 months ago
#18518 new enhancement
suggest.js: don't store the URL in the options object
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
...because it prevents re-using the same instance for different URLs:
var suggest_args = {
multiple : true,
delimiter : ',',
resultsClass : 'qc-suggest-results',
selectClass : 'qc-suggest-over',
matchClass : 'qc-suggest-match',
};
$( '#ticket-assign input' ).suggest( QC_L10N.ajaxurl + '?action=qc-user-search', suggest_args );
$( '#ticket-tags input' ).suggest( QC_L10N.ajaxurl + '?action=ajax-tag-search&tax=post_tag', suggest_args );
With the above code, both inputs will look for items in the same URL: the second one.
Attached patch fixes this.
Attachments (1)
Change History (5)
- Summary changed from Don't store the URL in the options object to suggest.js: don't store the URL in the options object
That extra argument only affects the internal constructor function, which shouldn't be used directly.
If it's really necessary, sure, you could check if it's an object vs. a string or check the number of arguments passed.
Note: See
TracTickets for help on using
tickets.

Will that extra argument be backwards compatible?
Could you add some code such that if source is an object rather than a string (i.e. only two arguments passed in), that source = options.source?