Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#28993 closed defect (bug) (fixed)

<img> srcset attribute is stripped when switching from text to visual tab in the editor

Reported by: kirillcool's profile kirillcool Owned by:
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.9.1
Component: TinyMCE Keywords:
Focuses: Cc:


Going to the "text" tab to add srcset attribute (manually) to the image, and then going to "visual" tab results in that attribute being stripped out.

Attachments (1)

28993.diff (222.1 KB) - added by mattheu 10 years ago.

Download all attachments as: .zip

Change History (11)

#1 @terminalpixel
10 years ago

I can confirm this occurs on a clean install of 4.0

#2 @sabreuse
10 years ago

+1 to this -- now that the spec is settled and support is out in the wild in FF and Chrome, I'd love to be able to start using srcsets natively.

#3 @mattheu
10 years ago


I think this issue should probably be fixed upstream in TinyMCE itself - I have opened a pull request on github to add this -

In the mean time - heres a patch that fixes it.

Note - I have also done this in the past by adding it to valid_elements using the tiny_mce_before_init filter, but I think it would be best to avoid doing this in core.

10 years ago

#4 @mattheu
10 years ago

Also opened PR for TinyMCE for picture element support as this is related:

#5 @iseulde
10 years ago

  • Component changed from Editor to TinyMCE

#6 @azaozz
9 years ago

Currently there is partial support for srcset, although most browsers that run on high pixel density devices support it. Asked upstream.

However only Chrome and Opera support <picture> (no mobile browsers support), and it seems it still has some problems/uncertainties. Perhaps better to wait few more months before trying to use it.

#7 @spocke
9 years ago

We merged in both pull requests. So srcset and picture elements should work as of 4.1.7. Thanks mattheu for helping out.

#8 @azaozz
9 years ago

  • Milestone changed from Awaiting Review to 4.1

Thanks @spocke. This will be in WordPress 4.1 after we update TinyMCE.

This ticket was mentioned in Slack in #core by nacin. View the logs.

9 years ago

#10 @azaozz
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [30397].

Note: See TracTickets for help on using tickets.