Bug Tracker

Ticket #11304 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Excess code in script.js?

Reported by: dcherman Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

I didn't want to file a PR since I might be wrong, but I don't think the following line actually does anything:

 https://github.com/jquery/jquery/blob/master/src/ajax/script.js#L25

If s.crossDomain is true, the corresponding script ajaxTransport doesn't even use the s.type property, so why set it?

Change History

comment:1 Changed 3 years ago by jaubourg

Consistency: the request automagically became a GET request because it was cross domain, callbacks can inspect the options object and control/use it.

comment:2 Changed 3 years ago by dcherman

Gotcha. Would you entertain a PR to add a comment above that line explaining exactly what you just described in case anyone has the same question in the future?

comment:3 Changed 3 years ago by addyosmani

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to ajax

@dcherman jaubourg may reply to this himself, but it's probably a good idea to go ahead and make the PR to add the comment and continue the discussion about whether it's worth adding on GH. That said, I imagine someone that has the same question in the future might try doing search of tickets on the tracker for further info.. :)

comment:4 Changed 3 years ago by jaubourg

I honestly dunno if a comment would benefit much. Code is pretty straight-forward in stating that cross-domain script requests are handled as GET requests.

Note: See TracTickets for help on using tickets.