Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-26-2008, 05:53 AM   PM User | #1
snoodle
Regular Coder

 
Join Date: May 2007
Location: Manteca, CA
Posts: 219
Thanks: 4
Thanked 0 Times in 0 Posts
snoodle is an unknown quantity at this point
Are Tables Overrated?

I was just working on this table, that scrolls inside a div and contains a bunch of images. I was having problems getting the photos aligned the way I wanted and I got to thinking...

...If you were to write your own "Table" object that consisted of an array of divs, each div stacked side by side, vertically and/or horizontally to make up the "Table" (each cell would be a div), well... would it make sense? What would the tradeoff's be as far as ease of manipulation (tables are weird sometimes and are not 100% browser compatible), and as far as browser performance? Is a div that has 1000 divs in it going to be less efficient than a table with 1000 single-column rows? I end up cramming stuff in the cell's innerHTML or setting a bunch of it's attributes, so would it be less efficient if that was just a <div> instead of a <td>? Feels like I would have more control over behavior and appearence.

Can someone save me some time and convince me that this is a dumb idea? Have I had too much vino tonight?

Last edited by snoodle; 04-26-2008 at 05:58 AM..
snoodle is offline   Reply With Quote
Old 04-26-2008, 06:32 AM   PM User | #2
Trinithis
Regular Coder

 
Join Date: Jun 2007
Location: USA
Posts: 527
Thanks: 26
Thanked 74 Times in 72 Posts
Trinithis will become famous soon enough
It will probably be slower. If anything, tables will work in js-disabled browsers.
Trinithis is offline   Reply With Quote
Old 04-26-2008, 07:29 AM   PM User | #3
snoodle
Regular Coder

 
Join Date: May 2007
Location: Manteca, CA
Posts: 219
Thanks: 4
Thanked 0 Times in 0 Posts
snoodle is an unknown quantity at this point
I'm building my own "framework" - yet another DOM wrapper - so I'm continuing to really understand how the browsers work and how HTML and the DOM get processed. So... if anyone can answer the question of why DIVs would be slower that would be most appreciated. Regardless, I think I'll go ahead and try a little experiement - just scroll 1000 divs with images in an enclosing container div - compare it to the <table>.

Dang. I gots to learns everything the hard way.
snoodle is offline   Reply With Quote
Old 04-26-2008, 07:49 AM   PM User | #4
snoodle
Regular Coder

 
Join Date: May 2007
Location: Manteca, CA
Posts: 219
Thanks: 4
Thanked 0 Times in 0 Posts
snoodle is an unknown quantity at this point
Eh, the <table> is working fine. nevermind.
snoodle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:40 PM.


Advertisement
Log in to turn off these ads.