[wp-trac] [WordPress Trac] #42414: Customize: Call to history.replaceState() before DOM ready in customizer preview causes error

WordPress Trac noreply at wordpress.org
Thu Nov 2 05:35:58 UTC 2017


#42414: Customize: Call to history.replaceState() before DOM ready in customizer
preview causes error
-------------------------------------------+--------------------------
 Reporter:  westonruter                    |       Owner:  westonruter
     Type:  defect (bug)                   |      Status:  accepted
 Priority:  normal                         |   Milestone:  4.9
Component:  Customize                      |     Version:  trunk
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch dev-feedback commit  |     Focuses:
-------------------------------------------+--------------------------
Description changed by westonruter:

Old description:

> In 4.9 the [https://github.com/WordPress/wordpress-
> develop/blob/d6aece2a336225e239798e99f163b30e2e9d8874/src/wp-includes/js
> /customize-preview.js#L22-L50 injectUrlWithState()] function was amended
> with a dependency on a `wp.customize.api.settings.changeset.autosave`
> global. However, `injectUrlWithState` can be called prior to DOM ready
> when that global is populated, and the result is an undefined error. This
> can be seen in the Picard theme which does `history.replaceState()`
> before the Customizer preview is able to initialize itself. So this
> dependency on the global needs to be removed.

New description:

 In 4.9 the [https://github.com/WordPress/wordpress-
 develop/blob/d6aece2a336225e239798e99f163b30e2e9d8874/src/wp-includes/js
 /customize-preview.js#L22-L50 injectUrlWithState()] function was amended
 in [41597] with a dependency on a
 `wp.customize.api.settings.changeset.autosave` global. However,
 `injectUrlWithState` can be called prior to DOM ready when that global is
 populated, and the result is an undefined error. This can be seen in the
 Picard theme which does `history.replaceState()` before the Customizer
 preview is able to initialize itself. So this dependency on the global
 needs to be removed.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42414#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list