Skip to content

Commit

Permalink
Add explanation comment for stripping the alt HTML
Browse files Browse the repository at this point in the history
Co-authored-by: Bernie Reiter <ockham@raz.or.at>
  • Loading branch information
WunderBart and ockham committed Nov 2, 2020
1 parent 5359033 commit 138e640
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/block-library/src/gallery/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default function save( { attributes } ) {
break;
}

// image.caption comes from a RichText component, so it can contain
// HTML that we need to strip. In GB 9.2, image.alt would fall back to
// image.caption without stripping the HTML, so we also run it through
// __unstableStripHTML here.
let alt = image.alt || image.caption;

if ( alt && alt !== __unstableStripHTML( alt ) ) {
Expand Down

0 comments on commit 138e640

Please sign in to comment.