WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 7 months ago

#42163 new defect (bug)

Customize: Add support for previewing requests made via the Fetch API

Reported by: westonruter Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch needs-testing
Focuses: javascript Cc:

Description

The Customizer preview supports applying the customized state to Ajax requests via jQuery.prefilterAjax. However, if a frontend is not using jQuery but rather the Fetch API then the customized state will not be injected into the request in order to have the customized state applied to the response. In the same way that customize-preview.js is wrapping history.replaceState() and history.pushState() to inject the customized state, we should also wrap fetch() to do the same. We may also want to do this for XMLHttpRequest as well.

Change History (2)

#1 @westonruter
8 months ago

  • Keywords has-patch needs-testing added
  • Version set to 4.7

Feature plugin for testing: https://github.com/xwp/wp-customize-preview-fetch-api

Pull requests welcome. There are some outstanding todos for supporting the passing of Request into fetch() as well as handling of Headers.

#2 @johnbillion
7 months ago

  • Milestone changed from 4.9.1 to 5.0
Note: See TracTickets for help on using tickets.