BenjaminWiegand wrote:
> 
> the jquery function show() is at the moment making objects visible by
> running
> elm.style.display = 'block';
> This works just fine for all block elements (div, etc.) but causes some
> problems when running on inline elements like links or other elements like
> table-cells.
> I think it'd be better to do this:
> elm.style.display =  get_type(elm);
> function get_type(elm) {
>     obj = document.createElement(elm.tagName);
>     $('body').append(obj);
>     type = $.curCSS(obj, 'display');
>     $(obj).remove();
>     return type;
> }
> 

First, if you take that route, you should definitely cache the default
display type per tag name. Creating elements repeatedly just to find out
their display property is a waste.

Matt

-- 
View this message in context: 
http://www.nabble.com/%24.show%28%29-improvement-tf3228045.html#a8972945
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to