New Perspectives On Web Design

(C. Jardin) #1

CHAPTER 3 The Vanilla Web Diet


However, this turned out to be overkill, as all that was needed was a
fixed-width design for older IE, letting the browser decide if responsive
design was within its powers or not.
How about we leave nobody out but build for the next generation of
technology? Give outdated browsers only what they can stomach: a bit of
CSS and HTML that really does the job. Semantic HTML that has meaning
and triggers functionality every browser offered from the start; links that
point somewhere; URLs that can be bookmarked; navigation that seeds
the history of the browser; forms that are validated and processed on the
server and sent back to the browser.
Only then should we add layers and layers of awesomeness for those
browsers which can deal with them. For example, take the wonderful and
standardized addEventListener(). OldIE doesn’t understand that, so
we wrote a filler to overwrite attachEvent(). Bad plan. This is software
ballast we’ll carry with us for years to come and it caters to a tiny sub-
group of users that will get smaller and smaller. Why not just wrap all of
our JavaScript in if (window.addEventListener) {} and never pester OldIE
with the demanding JavaScript we write these days?
The same logic applies to CSS. If we wrap the amazing and beautiful
parts of our CSS in a media query, OldIE and stock browsers will be none
the wiser and won’t try to parse what we give them.
Outdated browsers are retired; we shouldn’t pester them with more
and more demands to execute code that wasn’t meant for them and will
never run smoothly. If you use a filler library to support old browsers, you
also burden yourself with testing in them to make sure the users of those
browsers receive a smooth and beautiful experience. Testing outdated
browsers in the development environments we have today is a chore, and
only adds lots and lots of unhappy hours to our workload. Why do that?
Start with basic code that works in all browsers, then add to it and
make sure that browsers that should not be in use at all do not get code
they might choke on — you’ll leave everybody happy.
Free download pdf