Opened 10 years ago
Closed 4 years ago
#36631 closed enhancement (fixed)
wp.template() should throw an error if the template is not found
| Reported by: | joehoyle | Owned by: | desrosj |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.1 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | Focuses: | javascript |
Description
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.
Attachments (2)
Change History (11)
This ticket was mentioned in Slack in #core by talldanwp. View the logs.
6 years ago
#3
@
4 years ago
- Keywords 2nd-opinion needs-refresh removed
- Milestone → 6.1
Found this one while going through tickets missing a milestone. Adding an updated patch.
@noisysocks Care to give me a sanity check?
This ticket was mentioned in Slack in #core by chaion07. View the logs.
4 years ago
This ticket was mentioned in Slack in #core by hilayt24. View the logs.
4 years ago
#6
@
4 years ago
- Keywords needs-testing added
As per the discussion in the *6.1* Bug-Scrub, the latest patch looks good. I am adding a needs-testing tag to keep things smooth. Thanks, @costdev for the suggestions.
Props: @costdev
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Good suggestion @joehoyle! The patch doesn't apply cleanly anymore, but if you or someone else is happy to refresh it then I think let's get this in.