Skip to content

Commit

Permalink
Make escapeGreaterThan an unstable API function
Browse files Browse the repository at this point in the history
We don’t want people using it
  • Loading branch information
johngodley committed Dec 4, 2018
1 parent 3165b3a commit 350e10a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/escape-html/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function escapeLessThan( value ) {
*
* @return {string} Escaped string.
*/
export function escapeGreaterThan( value ) {
export function __unstableEscapeGreaterThan( value ) {
return value.replace( />/g, '>' );
}

Expand All @@ -74,15 +74,15 @@ export function escapeGreaterThan( value ) {
* split HTML strings. This is a WordPress specific fix
*
* Note that if a resolution for Trac#45387 comes to fruition, it is no longer
* necessary for `escapeGreaterThan` to exist in this module.
* necessary for `__unstableEscapeGreaterThan` to exist in this module.
*
* See: https://core.trac.wordpress.org/ticket/45387
* @param {string} value Attribute value.
*
* @return {string} Escaped attribute value.
*/
export function escapeAttribute( value ) {
return escapeGreaterThan( escapeQuotationMark( escapeAmpersand( value ) ) );
return __unstableEscapeGreaterThan( escapeQuotationMark( escapeAmpersand( value ) ) );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/escape-html/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
escapeAmpersand,
escapeQuotationMark,
escapeLessThan,
escapeGreaterThan,
__unstableEscapeGreaterThan,
escapeAttribute,
escapeHTML,
isValidAttributeName,
} from '../';

function testEscapeGreaterThan( implementation ) {
function testUnstableEscapeGreaterThan( implementation ) {
it( 'should escape greater than', () => {
const result = implementation( 'Chicken > Ribs' );
expect( result ).toBe( 'Chicken > Ribs' );
Expand Down Expand Up @@ -55,13 +55,13 @@ describe( 'escapeLessThan', () => {
} );

describe( 'escapeGreaterThan', () => {
testEscapeGreaterThan( escapeGreaterThan );
testUnstableEscapeGreaterThan( __unstableEscapeGreaterThan );
} );

describe( 'escapeAttribute', () => {
testEscapeAmpersand( escapeAttribute );
testEscapeQuotationMark( escapeAttribute );
testEscapeGreaterThan( escapeAttribute );
testUnstableEscapeGreaterThan( escapeAttribute );
} );

describe( 'escapeHTML', () => {
Expand Down

0 comments on commit 350e10a

Please sign in to comment.