wp/wp-includes/js/dist/autop.js
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
--- a/wp/wp-includes/js/dist/autop.js	Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/js/dist/autop.js	Fri Sep 05 18:52:52 2025 +0200
@@ -41,8 +41,6 @@
 /* harmony export */ });
 /**
  * The regular expression for an HTML element.
- *
- * @type {RegExp}
  */
 const htmlSplitRegex = (() => {
   /* eslint-disable no-multi-spaces */
@@ -97,9 +95,9 @@
 /**
  * Separate HTML elements and comments from the text.
  *
- * @param {string} input The text which has to be formatted.
+ * @param input The text which has to be formatted.
  *
- * @return {string[]} The formatted text.
+ * @return The formatted text.
  */
 function htmlSplit(input) {
   const parts = [];
@@ -110,7 +108,7 @@
     // If the `g` flag is omitted, `index` is included.
     // `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number.
     // Assert `match.index` is a number.
-    const index = /** @type {number} */match.index;
+    const index = match.index;
     parts.push(workingInput.slice(0, index));
     parts.push(match[0]);
     workingInput = workingInput.slice(index + match[0].length);
@@ -124,10 +122,10 @@
 /**
  * Replace characters or phrases within HTML elements only.
  *
- * @param {string}                haystack     The text which has to be formatted.
- * @param {Record<string,string>} replacePairs In the form {from: 'to', …}.
+ * @param haystack     The text which has to be formatted.
+ * @param replacePairs In the form {from: 'to', …}.
  *
- * @return {string} The formatted text.
+ * @return The formatted text.
  */
 function replaceInHtmlTags(haystack, replacePairs) {
   // Find all elements.
@@ -162,9 +160,9 @@
  * replace double line-breaks with HTML paragraph tags. The remaining line-
  * breaks after conversion become `<br />` tags, unless br is set to 'false'.
  *
- * @param {string}  text The text which has to be formatted.
- * @param {boolean} br   Optional. If set, will convert all remaining line-
- *                       breaks after paragraphing. Default true.
+ * @param text The text which has to be formatted.
+ * @param br   Optional. If set, will convert all remaining line-
+ *             breaks after paragraphing. Default true.
  *
  * @example
  *```js
@@ -172,7 +170,7 @@
  * autop( 'my text' ); // "<p>my text</p>"
  * ```
  *
- * @return {string} Text which has been converted into paragraph tags.
+ * @return Text which has been converted into paragraph tags.
  */
 function autop(text, br = true) {
   const preTags = [];
@@ -333,7 +331,7 @@
  * Replaces `<p>` tags with two line breaks except where the `<p>` has attributes.
  * Unifies whitespace. Indents `<li>`, `<dt>` and `<dd>` for better readability.
  *
- * @param {string} html The content from the editor.
+ * @param html The content from the editor.
  *
  * @example
  * ```js
@@ -341,13 +339,12 @@
  * removep( '<p>my text</p>' ); // "my text"
  * ```
  *
- * @return {string} The content with stripped paragraph tags.
+ * @return The content with stripped paragraph tags.
  */
 function removep(html) {
   const blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure';
   const blocklist1 = blocklist + '|div|p';
   const blocklist2 = blocklist + '|pre';
-  /** @type {string[]} */
   const preserve = [];
   let preserveLinebreaks = false;
   let preserveBr = false;
@@ -458,7 +455,7 @@
   // Restore preserved tags.
   if (preserve.length) {
     html = html.replace(/<wp-preserve>/g, () => {
-      return /** @type {string} */preserve.shift();
+      return preserve.shift();
     });
   }
   return html;