Opened 8 years ago
Closed 10 months ago
#43403 closed enhancement (wontfix)
Improve wp_add_inline_script()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Script Loader | Keywords: | |
| Focuses: | Cc: |
Description
Just an idea for the moment:
Instead of testing if the js has script tags and adding an error messages but also fixing the problem at the same time, why not accept both. If the passed data has tags just leave them (this would potentially fix #40276) and if not surround the code with plain <script> tags.
Change History (1)
Note: See
TracTickets for help on using
tickets.
Thanks, this is a reasonable idea, however there are some difficulties.
Primarily, it isn't easy to recognize where a script tag and ends. The current implementation is insufficient in that regard. There's a related change where the
HTML_Tag_processorshould be used to find the script contents in the case that it appears a script tag was provided.I'd be reluctant to make the change as described in this ticket becaue it can be problematic to print script tags that aren't vetted for correct escaping. That leads to issues like #62797.