I am trying to write some simple script tags into my *HTML* editor. I paste in something like;

<p><script src="foo.js"></script></p>

When I save the node, I am back in the Filtered HTML view, and I can verify the tinymce content is gone with:


I have allowed all elements in the extended_valid_elements object from within my custom plugin:

$settings['extended_valid_elements'] = "*[*]";

I have narrowed this down to the code within the tinyMCE Serializer:

Lines 14431-14434 in tiny_mce_src.js (v3.5.8):

// Parse and serialize the html
        if (args.format !== 'raw') {
          content = new tinymce.html.Serializer({}, self.schema).serialize(

Does anyone know of a way to get tinyMCE to NOT strip out my code?



TwoD’s picture

Status:Active» Postponed (maintainer needs more info)

Does this only happen when using TinyMCE with Wysiwyg?
Does it only happen in some browsers?

It works fine for me on http://www.tinymce.com/tryit/full.php in Chrome.

If only under Wysiwyg, try disabling the Teaser Break plugin or any other plugins belonging to Drupal modules. Wysiwyg passes content through it after TinyMCE has generated the final markup, but it's known to mess up some HTML (especially in any version of IE) and remove some tags because it uses the browser's functions to manipulate the contents as a DOM.

I have previously noticed that TinyMCE on its own will strip script tags if they are placed inside div tags, see #1454564-3: Tinymce strips Javascript.

If there's an error inside TinyMCE itself there's nothing we can do about it in Wysiwyg module, you'll have to create a bug report on their site.

TwoD’s picture

Status:Postponed (maintainer needs more info)» Closed (cannot reproduce)

Without further details about the problem I can only close this issue. Please re-open it if you can provide the requested information.
This seems like something which should be reported on the TinyMCE bugtracker, but they have recently rewritten their filtering for TinyMCE 4 so it may no longer be relevant.