Skip to content

Instantly share code, notes, and snippets.

@jshirley
Created October 3, 2009 18:07
Show Gist options
  • Save jshirley/200773 to your computer and use it in GitHub Desktop.
Save jshirley/200773 to your computer and use it in GitHub Desktop.
(function() {
YAHOO.widget.TrustingEditor = function(el, attrs) {
YAHOO.widget.TrustingEditor.superclass.constructor.call(this, el, attrs );
};
YAHOO.extend(YAHOO.widget.TrustingEditor, YAHOO.widget.Editor, {
_cleanIncomingHTML: function(html) {
html = html.replace(/<script([^>]*)>/gi, '<YUI_SCRIPT$1>');
html = html.replace(/<\/script([^>]*)>/gi, '</YUI_SCRIPT>');
html = YAHOO.widget.TrustingEditor.superclass._cleanIncomingHTML.call(this, html);
html = html.replace(/<YUI_SCRIPT([^>]*)>/gi, '&lt;script$1&gt;');
html = html.replace(/<\/YUI_SCRIPT([^>]*)>/gi, '&lt;/script&gt;');
return html;
},
cleanHTML: function(html) {
if (!html)
html = this.getEditorHTML();
delete this.invalidHTML.script;
html = html.replace(/&lt;script([^&>]*)&gt;/g, '<script$1>');
html = html.replace(/&lt;\/script&gt;/g, '<\/script>');
html = YAHOO.widget.TrustingEditor.superclass.cleanHTML.call(this, html);
return html;
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment