Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AJAX data source error #4356

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/js/select2.full.js
Expand Up @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ($request.status && $request.status === '0') {
if ('status' in $request && $request.status === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not going to break support for all browsers that have '0' ? shouldnt this be $request.status === 0 || $request.status === '0'?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For those who are using timeout : if ('status' in $request && $request.status === 0 && $request.statusText != "timeout")

return;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/js/select2.js
Expand Up @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ($request.status && $request.status === '0') {
if ('status' in $request && $request.status === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change dist files, for more info check CONTRIBUTING

return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/select2/data/ajax.js
Expand Up @@ -82,7 +82,7 @@ define([
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ($request.status && $request.status === '0') {
if ('status' in $request && $request.status === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question.

return;
}

Expand Down