I already tried to ask this question but obviously I did not explain it clear enough so let's try again.
Let's say I have some string variable that I want to check. This string could be generated by some "fancy textarea" plugin, come from ajax call or just have been pasted from some WYSIWYG editor. Anyway, the task is to write a function that would check if this string is empty. However though by "empty" I mean that this string does not hold any actual content so if it consists of some empty tags like <p><span></span></p> it still is considered as empty.
Also, I can modify it's content if needed so I though about removing empty nodes but I do not know how can I do this when I do not operate on document. If I were operating on document I could just run something like:
$('*').each(function(index, item) {
if($.trim($(item).text()) === "") {
$(item).remove();
}
});
So the question is: how could I implement a function isEmpty(string) -> boolean that would ignore empty html tags in given string?