Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#30299 closed Cleanup/optimization (fixed)

Remove jQuery dependency from getCookie() function in CSRF docs

Reported by: Matthew Pava Owned by: nobody
Component: Documentation Version: 2.1
Severity: Normal Keywords: ajax jquery getCookie
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The Django docs provide a very nice function to obtain the session cookie, but it depends on jQuery being installed.

The code is here:
https://docs.djangoproject.com/en/2.1/ref/csrf/#ajax

We should remove the dependency on jQuery, and it looks like there's only one line that needs to be updated.
Replace
var cookie = jQuery.trim(cookies[i]);
with
var cookie = cookies[i].trim();

str.trim() is supported in every modern browser.

Change History (3)

comment:1 by Tim Graham, 6 years ago

Summary: Update AJAX Documentation getCookie ImplementationRemove jQuery dependency from getCookie() function in CSRF docs
Triage Stage: UnreviewedReady for checkin

comment:2 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In ffdacc58:

[2.2.x] Fixed #30299 -- Removed jQuery dependency from getCookie() in CSRF docs.

Backport of 8e675e2bd8366adf5d0b579accfef75a7b1bc3bf from master

comment:3 by Tim Graham <timograham@…>, 6 years ago

In 8e675e2b:

Fixed #30299 -- Removed jQuery dependency from getCookie() in CSRF docs.

Note: See TracTickets for help on using tickets.
Back to Top