This particular problem:
Try rethinking the logic a bit and make noDelay
actual delay effect.
$(element).find("." + options.class).fadeOut(noDelay ? 0 : 'normal').remove();
Although I'm not sure if remove()
is required.
When I did the fadeOut()
tests for another question, it seemed to hide and collapse the element. remove()
will completely remove the element from the DOM, but I'm not sure if this is necessary if you just want it to disappear from the document and not stop working with the document flow (without spaces where it was).
The real goal:
Also, it looks like you're planning on porting jQuery. You end up wrapping the code like this:
$("someElement").find(".someClass").fadeOut().remove();
... and changing it to something like:
fadeOut("someElement", { "class" : "someClass" });
... or:
var element = new SomeClass("someElement"); element.options.class = "someClass"; element.fadeOut();
If you plan on reusing this particular element, I think you're going to waste your time. jQuery has a pretty efficient syntax for one-time operations, and you can always store consistent elements in a temporary variable.
If you have any other goal in mind that I am missing, please excuse this intrusion into your design :)
source share