This works well for me on firefox and safari. I have not tested on other browsers. I am posting my updated findUp() method here, if it warks across the board, it would be a useful addition.
- Code: Select all
/* @name findUp
* @description Returns the first parent or self container, based on its type
*/
WYMeditor.editor.prototype.findUp = function(node, filter) {
//filter is a string or an array of strings
if(node) {
if(typeof(filter) == WYMeditor.STRING) {
var jNode = jQuery(filter,jQuery(node.parentNode));
if(jNode.length > 0 && jNode[0] == node) { //match current node
return(node);
} else {
var jNode = jQuery(node).parents(filter + ":first");
if(jNode.length > 0) {
return(jNode[0]);
}
}
return(null);
} else {
var bFound = false;
var i = 0;
while(!bFound && i < filter.length) {
var resultNode = this.findUp(node, filter[i]);
if(resultNode) {
return (resultNode);
}
i++;
}
return(null);
}
} else return(null);
};
-Eric