close

Make WordPress Core

Changeset 61886


Ignore:
Timestamp:
03/10/2026 12:43:50 PM (3 days ago)
Author:
johnbillion
Message:

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

Props johnbillion, peterwilsoncc, jorbin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/util.js

    r54241 r61886  
    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.