• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hide show vs inserting/deleting html

 
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using backbone js. I have a screen with two pages. I have two options I can render both pages at same time and then hide/show based on selection. Other thing is rendering each page separately. Second approach looks better to me and if I am not wrong. In both cases browser will have to re-paint? Please correct me if I am wrong.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Better" has to be measured against some criteria or objective. What are you measuring against? Browser speed? Memory usage? Clarity of code?
 
pawan chopra
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:"Better" has to be measured against some criteria or objective. What are you measuring against? Browser speed? Memory usage? Clarity of code?



I am looking for good performance. So browser speed is what I am measuring against.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, next question then: do you really think there will be a user-discernable difference between the approaches?

What I'm getting at is that if it were my project, I would first strive for code clarity, and then if, and only if, a performance issue arises, start looking at different approaches.

Is there a demonstrable performance problem you are trying to solve?
 
pawan chopra
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:OK, next question then: do you really think there will be a user-discernable difference between the approaches?

What I'm getting at is that is it were my project, I would first strive for code clarity, and then if, and only if, a performance issue arises, start looking at different approaches.

Is there a demonstrable performance problem you are trying to solve?



Not really didn't have any issue till now. I am currently rendering instead of show/hide. I feel its clean and simple. Not sure if you agree with me. But other than that am I right that in both ways browser will re-paint?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, "repaint" isn't really a term often used with browsers, but yes, anything that changes the display will cause the browser to, well, change the display.
 
expectation is the root of all heartache - shakespeare. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic