You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When are these functions expected to be used? In particular the combination of "strip tags and encode HTML entities" seems a bit strange to me. @nylen -
In WordPress core, the functions are used in wp-admin/js/press-this.js. sanitizeText is called in getTitleText to safely set the untrusted title text: $( '#post_title' ).val( getTitleText() );. stripTags is used in that function and also might be generally useful: it uses regexs to strip tags from content.
Should we consider a package if / when the time comes we decide to port that into the mono-repository? Ties back into some of the conversation in yesterday's JavaScript chat about not proactively porting modules.
There's also a combination of escape-html (introduced by @ellatrix in #7890) and html-entities (introduced by @gziolo in #7977) which can cover some of the proposed requirements.
@adamsilverstein commented on Tue Jul 18 2017
These could use some unit tests.
@nylen commented on Tue Jul 25 2017
When are these functions expected to be used? In particular the combination of "strip tags and encode HTML entities" seems a bit strange to me.
@ntwb commented on Wed Aug 16 2017
I've added a handful of basic tests for
stripTags
via WordPress/packages@7e360f0@codecov[bot] commented on Fri Aug 18 2017
Codecov Report
0% <0%> (ø)
0% <0%> (ø)
100% <100%> (ø)
Continue to review full report at Codecov.
@adamsilverstein commented on Fri Aug 18 2017
@notnownikki commented on Mon Aug 21 2017
I just added a
decodeEntities
util to Gutenberg, and it was suggested it might be relevant here too.Commit is at f08c5f4 , if it's useful I'm happy to work on contributing it here.
@adamsilverstein commented on Tue Oct 10 2017
@notnownikki that does seem useful, not sure it belongs with
sanitize
? I had originally put these helpers in wp.utils, only later separating them out.The text was updated successfully, but these errors were encountered: