Opened 3 months ago
Closed 4 weeks ago
#23787 closed defect (bug) (fixed)
Gallery displayed even when the gallery shortcode is inside an HTML comment
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Gallery | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | info@… |
Description
The gallery shortcode emits HTML comment which cause HTML to break when the shortcode is inside a comment as HTML doesn't support nested comments
Adding the following in the text editor
<!-- [gallery ids="423,424,202,155,148,150"] -->
generates the following HTML
<!--
<style type='text/css'>
#gallery-1 {
margin: auto;
}
#gallery-1 .gallery-item {
float: right;
margin-top: 10px;
text-align: center;
width: 33%;
}
#gallery-1 img {
border: 2px solid #cfcfcf;
}
#gallery-1 .gallery-caption {
margin-left: 0;
}
</style>
<!-- see gallery_shortcode() in wp-includes/media.php -->
...
-->
related #23786
Attachments (2)
Change History (9)
comment:1
SergeyBiryukov
— 3 months ago
- Milestone changed from Awaiting Review to 3.6
comment:5
aaroncampbell
— 4 weeks ago
It seems like putting a gallery shortcode inside an html comment in a little edge-case, gallery.patch looks like a simple fix and I don't think the comment offers enough of a benefit to justify keeping it.
aaroncampbell
— 4 weeks ago
comment:6
aaroncampbell
— 4 weeks ago
Nacin had a good idea, so 23787.diff moves the comment to a CSS comment instead of removing it.
comment:7
SergeyBiryukov
— 4 weeks ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 24329:
I guess we could remove the HTML comment from gallery_shortcode() (as you suggested in #23786), it doesn't seem necessary.