[wp-trac] [WordPress Trac] #48880: Using JSON.parse instead of an actual object literal when localizing scripts

WordPress Trac noreply at wordpress.org
Thu Dec 5 09:54:40 UTC 2019


#48880: Using JSON.parse instead of an actual object literal when localizing
scripts
---------------------------+--------------------------------------
 Reporter:  naxvog         |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:  5.3
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript, performance
---------------------------+--------------------------------------

Comment (by gziolo):

 I was talking with @aduth that we could use this technique in other
 places, one of them is:

 {{{
 wp.apiFetch.createPreloadingMiddleware()
 }}}

 It is used in Gutenebrg to preload REST API requests on the server.

 It looks like is another one:

 {{{
 wp.editPost.initializeEditor()
 }}}

 It might also contain tons of data once the theme opts-in to provide some
 custom CSS.

 There is also this REST API config which is exposed in HTML source which
 can grow big which is another one to consider. It might be already
 included in the preloading middleware though.

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


More information about the wp-trac mailing list