Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #39912, comment 3


Ignore:
Timestamp:
02/18/2017 08:49:00 PM (8 years ago)
Author:
afercia
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #39912, comment 3

    v1 v2  
    11I think it's because the `wpeditimage` TinyMCE plugin uses `tinymce.dom.DOMUtils.setAttribs` which just recursively calls `tinymce.dom.DOMUtils.setAttrib` which accepts 3 params, and about the `value` one:
    2 > Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove the attribute instead.
     2> Value to set on the attribute - if this value is falsy like null, 0 or "" it will remove the attribute instead.
    33
    44So when `wp.media` passes an empty alt attribute, TinyMCE just strips it out. It makes sense to remove empty HTML attributes, with the notable exception of the `alt` attribute. While WordPress should ensure this doesn't happen and try to find a way to re-add the empty alt attribute when appropriate, maybe this should be reported upstream too.