PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | modules/shortcodes/js/slideshow-shortcode.js +1 -32 16.3 → 16.3-beta View file →
@@ -1,37 +1,6 @@
1 1 /* global jetpackSlideshowSettings */
2 2
3 -/**
4 - * Turn a gallery caption into the plain text it is meant to be.
5 - *
6 - * A caption is meant to read as text, but wptexturize() leaves HTML entities behind, so it needs
7 - * decoding before it can be set as one.
8 - *
9 - * @param {*} caption - Caption value from the gallery data.
10 - * @return {string} The decoded caption, as text.
11 - */
12 -function jetpackSlideshowCaptionText( caption ) {
13 - if ( typeof caption !== 'string' || '' === caption ) {
14 - return '';
15 - }
16 -
17 - var parsed = new DOMParser().parseFromString( caption, 'text/html' );
18 -
19 - // These land in the body when they appear mid-caption, and their source is not caption text.
20 - parsed.body
21 - .querySelectorAll( 'script, style, noscript, template' )
22 - .forEach( function ( element ) {
23 - element.remove();
24 - } );
25 -
26 - // Without a space in its place, a caption broken over two lines reads as "Ada LovelaceLondon".
27 - parsed.body.querySelectorAll( 'br' ).forEach( function ( element ) {
28 - element.replaceWith( ' ' );
29 - } );
30 -
31 - return parsed.body.textContent;
32 -}
33 -
34 3 function JetpackSlideshow( element, transition, autostart ) {
35 4 this.element = element;
36 5 this.images = [];
37 6 this.controls = {};
@@ -69,9 +38,9 @@
69 38 img.nopin = 'nopin';
70 39 var caption = document.createElement( 'div' );
71 40 caption.className = 'jetpack-slideshow-slide-caption';
72 41 caption.setAttribute( 'itemprop', 'caption description' );
73 - caption.textContent = jetpackSlideshowCaptionText( imageInfo.caption );
42 + caption.innerHTML = imageInfo.caption;
74 43 var container = document.createElement( 'div' );
75 44 container.className = 'jetpack-slideshow-slide';
76 45 container.setAttribute( 'itemprop', 'associatedMedia' );
77 46 container.setAttribute( 'itemscope', '' );