Support » Fixing WordPress » 4.8 Text Widget strips onmouseover,onmouseout events from img tags

  • I created a new clean installation of WordPress 4.7.5 and used the twentysixteen theme.

    I created a text widget containing:

    
    <img name="pmbtn_lc" src="http://klaroty.com/clients/48test/wp-content/uploads/2017/06/lc_btn_focus.png"
    onmouseover="document['pmbtn_lc'].src = 'http://klaroty.com/clients/48test/wp-content/uploads/2017/06/lc_btn_normal.png'" 
    onmouseout="document['pmbtn_lc'].src = 'http://klaroty.com/clients/48test/wp-content/uploads/2017/06/lc_btn_focus.png'"
    onclick="window.location='http://klaroty.com/clients/48test/'"
    			style="cursor:pointer;margin:0;padding:0;width:58px">
    

    After updating to 4.8 the text widget contents:
    NOTE: I preplaced the ‘<‘ and ‘>’ wit GT and LT to make it readable here:
    LTimg style="cursor: pointer; margin: 0; padding: 0; width: 58px;" src="http://klaroty.com/clients/48test/wp-content/uploads/2017/06/lc_btn_focus.png" name="pmbtn_lc" /GT

    • This topic was modified 3 months, 2 weeks ago by  dbarnhart.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Marius L. J.

    (@clorith)

    Hi,

    With the 4.8 update, we introduced TinyMCE to the text widget as well, unfortunately this does have some side effects, like stripping of unexpected elements and similar.

    If you use only the Text tab of the editor, and have the correct access (such as an admin that can post unfiltered html), you should be able to post the content in, but be aware that switching to the visual mode again may strip HTML unexpectedly.

    We’re planning on introducing a stand along widget for HTML, but it was not something done for 4.8

    Why break existing functionality instead of introducing a RichText Widget (which already exists there are probably more…)

    @dbarnhart maybe you can use good old Otto’s PHP widget

    Hurting me, too. I’ve got an SVG in a text widget that gets whacked in Visual mode, and I have some unsophisticated editors. “Don’t look behind the [visual] curtain!” instruction is not reliable. Would like to see a better solution. (Greatly appreciate the efforts to improve, though.)

    I grabbed the old text widget code from WP version 4.7.5 and turned it into a plugin. That way I don’t have to worry about unsophisticated editors (or myself when I’ve not had enough sleep).

    I agree though that they should have left the existing text widget along and created a new one named ‘Rich Text Widget’

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.