Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Is there a way to use less divs in HTML?

HTML

  • Please log in to reply
36 replies to this topic

#37 JasonKnight

JasonKnight

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 312 posts
  • Location:Keene, NH
  • Programming Language:C, C++, JavaScript, Delphi/Object Pascal, Pascal, Assembly, Others

Posted 09 April 2013 - 07:56 AM

I got rid of the image copy and image updates because here at least, particularly on laptop and tablet, it was taking longer than just dumping the entire frame. Didn't know that you were aiming for save-as functionality with that (The lack of clear instructions or intuitive interface left me guessing -- A LOT), though I did figure out how you were doing the frame updates.

Generally making images that much and playing with them is too heavy on memory use -- part of why your version is useless on my droid tablet, while mine is usable. If I were to add a save image capability I'd dialog box it the same way as the export function.

.. and yeah, 'plot()' should be added to the onresize handler.

As to lines of code, that's generally meaningless given the difference in formatting. You'll find I use a LOT more carriage returns and tabs than other programmers. Your's is 8.8k, mine is 10.4k, far closer than the line-count. What's most of that 1.6k? The media queries and reset add up to 889 bytes, the viewport meta, recommendation doctype, http-equiv for proper local rendering, language encodings, H1 so search engines at least have something to look at and noscript paragraph -- much less the CSS LINK with a proper media embed (rather than sending the same style from the script to all media targets) brings them right in-line with each-other... and that's before talking the things like canvas failure detection/warning, resize code, etc, etc...

Really though, line counts can't be trusted -- never have been unless you're charging by the K-LoC like a 1970's Cobol scam artist. **, I usually end up with four times as many lines just because I don't stuff my CSS properties on the same line as their selectors, and like to break HTML attributes onto their own lines -- in both cases for code clarity. You can see this in my javascript too.

I really like tall and narrow without word-wrap, probably because I think garbage like IDE's and tabbed editors are a step backwards in functionality -- also part of why I like to keep my HTML separate from my CSS from my JS -- that way I can open them up in three separate editor windows and look at them side-by-side, saving on the scrolling and being able to see it all together at once. (then on one of the other displays have the browsers for testing)

I mean, which of these is more code:
#plotSettings { padding-bottom:0.5em; text-align:right; line-height:1.8em; }
or
#plotSettings {
	padding-bottom:0.5em;
	text-align:right;
	line-height:1.8em;
}
... and which one's easier to scan to figure out what properties are set? ooh, there's 3 bytes difference between them :/

Honestly if I was doing this 'seriously', I'd have a fourth file, a .php and have the form in the markup static with a submit to that php -- then use the GD module to make a image on submit so people with scripting disabled/blocked would still get something (just without the animation)... but that's the core of good site building, make it work without javascript as much as possible then enhance it with JS.

Not always possible, but that's the ideal. Though really I'm not a fan of web crapplets (you'd never guess) and spend more time working with sites that are content oriented.

Edited by JasonKnight, 09 April 2013 - 07:57 AM.

  • 0
The only thing about Dreamweaver that can be considered professional grade tools are the people promoting it's use.





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download