Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save keithnorm/266862 to your computer and use it in GitHub Desktop.
Save keithnorm/266862 to your computer and use it in GitHub Desktop.
Object.extend(Element.Methods, {
show: function(el) {
//fixing prototypes show method so that it works for elements hidden via css too (like jquery)
var display = el.getStyle("display");
if(display === "none") {
var elem = new Element(el.tagName);
$$("body").invoke("insert", elem);
display = elem.getStyle("display");
if (display === "none")
display = "block";
elem.remove();
}
el.setStyle({"display": display});
return el;
}
});
Element.addMethods();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment