From 6004aa82894ffb7672ec45498a1bdfadc2aeda24 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sat, 6 Sep 2008 22:47:26 -0700 Subject: [PATCH] Ensure Element.hide and Element.show return an element, even if you pass an element ID. --- CHANGELOG | 2 ++ src/dom.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4514274..5e510de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Ensure Element.hide and Element.show return an element, even if you pass an element ID. (Andrew Dupont) + * Fix an issue where Element#getStyle('height') returns null if the height is set to "auto." (kangax, jddalton) * Add unit tests for Element#descendantOf. (jddalton) diff --git a/src/dom.js b/src/dom.js index df0162b..f52bc71 100644 --- a/src/dom.js +++ b/src/dom.js @@ -74,12 +74,14 @@ Element.Methods = { }, hide: function(element) { - $(element).style.display = 'none'; + element = $(element); + element.style.display = 'none'; return element; }, show: function(element) { - $(element).style.display = ''; + element = $(element); + element.style.display = ''; return element; },