Changeset 63059
- Timestamp:
- 08/06/2026 03:29:43 PM (6 weeks ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
js/_enqueues/lib/emoji-loader.js (modified) (1 diff)
-
wp-includes/class-wp-script-modules.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/lib/emoji-loader.js
r61134 r63059 17 17 */ 18 18 19 const settings = /** @type {WPEmojiSettings} */ ( 20 JSON.parse( document.getElementById( 'wp-emoji-settings' ).textContent ) 21 ); 19 const selector = 'script#wp-emoji-settings'; 20 const script = document.querySelector( selector ); 21 if ( ! ( script instanceof HTMLScriptElement ) ) { 22 throw new Error( `Element missing: ${ selector }`); 23 } 24 const settings = /** @type {WPEmojiSettings} */ ( JSON.parse( script.text ) ); 22 25 23 26 // For compatibility with other scripts that read from this global, in particular wp-includes/js/wp-emoji.js (source file: js/_enqueues/wp/emoji.js). -
trunk/src/wp-includes/class-wp-script-modules.php
r62278 r63059 1059 1059 * tag with an ID of the form `wp-script-module-data-{$module_id}`. 1060 1060 * 1061 * The data can be read on the client with a pattern like this: 1061 * The data can be read on the client with a pattern like the following; you are encouraged 1062 * to use this pattern _verbatim_ to avoid common pitfalls or vulnerabilities: 1062 1063 * 1063 1064 * Example: 1064 1065 * 1065 * const dataContainer = document. getElementById( 'wp-script-module-data-MyScriptModuleID' );1066 * const dataContainer = document.querySelector( 'script[id="wp-script-module-data-MyScriptModuleID"]' ); 1066 1067 * let data = {}; 1067 * if ( dataContainer ) {1068 * if ( dataContainer instanceof HTMLScriptElement ) { 1068 1069 * try { 1069 * data = JSON.parse( dataContainer.text Content);1070 * data = JSON.parse( dataContainer.text ); 1070 1071 * } catch {} 1071 1072 * }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)