Friday, December 31, 2010

Fixing WymEditor from stripping out YouTube embedded links

JavaScript/jQuery doesn't come with a routine to remove elements from an array, so we create one as follows. This code was inspired from the MooTools v1.3 code:
Array.prototype.remove = function(item)
    for(var i = this.length; i--;) {
        if(this[i] === item) this.splice(i,1);
    return this;

We'll later use this remove() function to remove <param> tag from being considered as a block tag, and insert param/embed tags an inline_tags.
var XhtmlSaxListener = WYMeditor.XhtmlSaxListener;
        WYMeditor.XhtmlSaxListener = function () {
            var listener =;
            return listener;
If we really wanted to be consistent, we could also use the following statements with the WymEditor patch, we can do the following:
WYMeditor.XhtmlValidator['_tags']["embed"] = {
WYMeditor.XhtmlValidator['_tags']['param'] = {
            "attributes" : ["type", "value", "name"],
            "required" : "name",
            "inside" : "object"

1 comment:

  1. I have just installed iStripper, so I can watch the hottest virtual strippers on my desktop.