Make WordPress Core

Changeset 61897


Ignore:
Timestamp:
03/10/2026 02:02:05 PM (4 weeks ago)
Author:
audrasjb
Message:

Administration: Ensure client-side templates are only detected when they're correctly associated with a script tag.

Merges [61886] to the 6.9 branch.
Props johnbillion, peterwilsoncc, jorbin.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/src/js/_enqueues/wp/util.js

    r54241 r61897  
    3737
    3838        return function ( data ) {
    39             if ( ! document.getElementById( 'tmpl-' + id ) ) {
     39            var el = document.querySelector( 'script#tmpl-' + id );
     40            if ( ! el ) {
    4041                throw new Error( 'Template not found: ' + '#tmpl-' + id );
    4142            }
    42             compiled = compiled || _.template( $( '#tmpl-' + id ).html(), options );
     43            compiled = compiled || _.template( $( el ).html(), options );
    4344            return compiled( data );
    4445        };
Note: See TracChangeset for help on using the changeset viewer.