On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I have TinyMCE 2.1.1.1 running on 0.9.6, and I’m having a problem I’m not sure how to fix.

    Basically, TinyMCE is stripping empty alt attributes (alt=""). It leaves alt alone when it’s not empty, though.

    Anyone know how to fix that, because I want the option for empty alt to be available.
    • Err...not to be silly but what is the reason for wanting empty alt attributes? I think TinyMCE strips them out simply because an empty attribute doesn’t really serve any purpose. Now, if its due to a Javascript function needing an alt attribute to work...well...I’d probably rework the script to automatically add the attribute in if it’s missing. This is more of a question for the Moxiecode people but my opinion is that this is not a bug but a feature. If you don’t want TinyMCE to mess with your code, try turning off the Cleanup option. smiley
        Jeff Whitfield

        "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
      • Validation. Fails without the alt="" (even if it’s blank it passes!).
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • But isn’t that only on IMG and INPUT tags? If you’re inserting in an image, why wouldn’t you add a description to populate the ALT attribute with?
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
          • What Ryan says. smiley

            And you would choose not to add a description if the image was simply decorative. The alt attribute is supposed to provide the equivalent content to the image, so if the image serves no purpose other than decoration, you should have an empty alt attribute. For validation and accessibility reasons, you wouldn’t want to omit the alt entirely.

            (You could argue that purely decorative images should be included as background images, but that’s not practical in a CMS).

            Okay, so it’s something Moxiecode have introduced, wrongly in my opinion. I’m pretty certain some earlier versions of TinyMCE didn’t do this. Ah well. smiley
            • Turning off the cleanup configuration option should take care of it. There’s also probably a list of items that it will strip out (or one that can be set to ignore...).
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me