Front End Flashcards
1
Q
What happens during the layout or reflow process in a browser
A
The browser calculates different element sizes and positions
2
Q
What is the painting part of a browser process
A
Painting refers to physically rendering pixels to a screen
3
Q
What are the main components of a browser
A
- UI - everything the user sees except the main window
- Browser Engine - marshals actions between the ui and rendering engine
- Rendering Engine - responsible for displaying content. For example if displaying html. Engine parses html and css and displays it on the screen. Can also render pdfs, images, xml etc. Different browsers use different engines. Chrome and Opera use Blink a fork of webkit which Safari uses.
4. Networking - responible for network calls like http rquests
- UI Backend - used for drawing basic widets like combo boxes and windows. Exposes a generic interface that is not platform specific. Uses OS UI methods.
- JavaScript Interpreter - Parses and executes JS
- Data Storage- persistence layer which in cludes cookies, localStorage IndexedDB, websql, and filesystem.
4
Q
Add more
A
https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#CSS_parsing
5
Q
What is a virtual DOM in react?
What components does it involve. What advantages does it have?
A
- An in memory representatino of the dom
- a way to translate that memory tree into the real dom
- a diffing algorathim that compares changes.
a. DOM manipulation is quicker in memory, not all the flow processes are need before a final update (reflow, paint etc).
c. Real DOM manip required imperative programming, you repeatedly tell the program how to change and iterate. UI programming is easier when declarative programming is involed - tell it what we want to see.
c. Sits between the browser dom and application developer.
d. It is an abstraction, just makes it easier for devloper to use the dom properly.
6
Q
What are the three steps to designing Internationalization (intl,i18n).
A
- Detect Users Locale
- Translate UI Elements (titles as well as hints etc)
- Serving locale-specific content like dates, currencies and numbers.
7
Q
How do you detect a user’s Locale
A
- The main way to guess a language is using hte Accept-Language header in HTTP requests that all modern browsers send which detects what their OS language is.
- This can have a range: Accept-Language: da, en-gb;q=0.8, en;q=0.7. (meaning this user prefers danish but will accept british english or other types of english). - Older ways to use Geo location with IP address but this approach can often be inaccurate (for travels and second language speakers, etc)
- Accept-=Language can still be imperfect so as a stop gap implement a language widget.