Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#40640 closed defect (bug) (duplicate)

code changed between visual and text views

Reported by: sninad's profile sninad Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.4
Component: Editor Keywords:
Focuses: Cc:

Description

I open a blog post with this input field in TEXT view and see:

<input style="width: 100%; display: inline-block !important; height: 40px; margin-bottom: 8px; box-sizing: border-box;" name="FNAME" required="" type="text" value="" placeholder="Type your First Name here..." onkeyup="document.getElementById('HELP').value = 'Contact Us';" />

Note: the onkeyup element is to detect robot signups to my site.

I go to VISUAL view and then go back to TEXT view and get the following:

<input style="width: 100%; display: inline-block !important; height: 40px; margin-bottom: 8px; box-sizing: border-box;" name="FNAME" required="" type="text" value="" placeholder="Type your First Name here..." />

The onkeyup action is removed by the editor.

So, without making any changes, I VIEW PAGE, and VIEW SOURCE and the onkeyup action is there.

Change History (1)

#1 @dd32
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This was previously covered in #35953 and #27858

The Visual editor which we use disables the on* attributes for security purposes, #27858 links to a filter/plugin which you can utilise to change the behaviour if required.

I'd highly suggest for your use-case to consider a plugin & shortcode solution rather than attempting to put the HTML/CSS/JS directly into the post.

Note: See TracTickets for help on using tickets.