This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+16 -14
View File
@@ -2,6 +2,8 @@
* @output wp-includes/js/wp-sanitize.js
*/
/* eslint-env es6 */
( function () {
window.wp = window.wp || {};
@@ -16,24 +18,24 @@
/**
* Strip HTML tags.
*
* @param {string} text Text to strip the HTML tags from.
* @param {string} text - Text to strip the HTML tags from.
*
* @return Stripped text.
* @return {string} Stripped text.
*/
stripTags: function( text ) {
text = text || '';
let _text = text || '';
// Do the replacement.
var _text = text
// Do the search-replace until there is nothing to be replaced.
do {
// Keep pre-replace text for comparison.
text = _text;
// Do the replacement.
_text = text
.replace( /<!--[\s\S]*?(-->|$)/g, '' )
.replace( /<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/ig, '' )
.replace( /<\/?[a-z][\s\S]*?(>|$)/ig, '' );
// If the initial text is not equal to the modified text,
// do the search-replace again, until there is nothing to be replaced.
if ( _text !== text ) {
return wp.sanitize.stripTags( _text );
}
} while ( _text !== text );
// Return the text with stripped tags.
return _text;
@@ -42,12 +44,12 @@
/**
* Strip HTML tags and convert HTML entities.
*
* @param {string} text Text to strip tags and convert HTML entities.
* @param {string} text - Text to strip tags and convert HTML entities.
*
* @return Sanitized text. False on failure.
* @return {string} Sanitized text.
*/
stripTagsAndEncodeText: function( text ) {
var _text = wp.sanitize.stripTags( text ),
let _text = wp.sanitize.stripTags( text ),
textarea = document.createElement( 'textarea' );
try {