Opened 8 years ago
Closed 2 years ago
#36631 closed enhancement (fixed)
wp.template() should throw an error if the template is not found
Reported by: | joehoyle | Owned by: | desrosj |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch needs-testing |
Focuses: | javascript | Cc: |
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.
4 years ago
#3
@
2 years ago
- Keywords 2nd-opinion needs-refresh removed
- Milestone set to 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.
2 years ago
This ticket was mentioned in Slack in #core by hilayt24. View the logs.
2 years ago
#6
@
2 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, @chaion07
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.