[wp-trac] [WordPress Trac] #36631: wp.template() should throw an error if the template is not found

WordPress Trac noreply at wordpress.org
Fri Apr 22 10:16:07 UTC 2016


#36631: wp.template() should throw an error if the template is not found
-------------------------+-----------------------------------
 Reporter:  joehoyle     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:  has-patch 2nd-opinion
  Focuses:  javascript   |
-------------------------+-----------------------------------
 When calling `wp.template()` in JS, if the template element does not exist
 (maybe you forgot to wait for `document.ready`) a very cryptic error
 happens ("Uncaught TypeError: Cannot read property 'replace' of
 undefined"). I'm not totally familiar with how defensive we typically are
 for things like this - but in this case it would have saved me a good deal
 of effort if I saw a descriptive error.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36631>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list