Skip to content

Commit

Permalink
DOM: Mark stripHTML as unstable (#19725)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored Jan 17, 2020
1 parent c8a1eef commit cf9742c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/blocks/src/api/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { default as tinycolor, mostReadable } from 'tinycolor2';
*/
import { Component, isValidElement } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { stripHTML } from '@wordpress/dom';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';

/**
* Internal dependencies
Expand Down
12 changes: 0 additions & 12 deletions packages/dom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,6 @@ _Returns_

- `Element`: The new node.

<a name="stripHTML" href="#stripHTML">#</a> **stripHTML**

Removes any HTML tags from the provided string.

_Parameters_

- _html_ `string`: The string containing html.

_Returns_

- `string`: The text content with any html removed.

<a name="unwrap" href="#unwrap">#</a> **unwrap**

Unwrap the given node. This means any child nodes are moved to the parent.
Expand Down
2 changes: 1 addition & 1 deletion packages/dom/src/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ export function wrap( newNode, referenceNode ) {
*
* @return {string} The text content with any html removed.
*/
export function stripHTML( html ) {
export function __unstableStripHTML( html ) {
const document = new DOMParser().parseFromString( html, 'text/html' );
return document.body.textContent || '';
}
2 changes: 1 addition & 1 deletion packages/dom/src/test/dom.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import { isHorizontalEdge, placeCaretAtHorizontalEdge, isTextField, stripHTML } from '../dom';
import { isHorizontalEdge, placeCaretAtHorizontalEdge, isTextField, __unstableStripHTML as stripHTML } from '../dom';

describe( 'DOM', () => {
let parent;
Expand Down

0 comments on commit cf9742c

Please sign in to comment.