HTML5 Shim vs. Shiv

HtmlInternet ExplorerHtml5shiv

Html Problem Overview


Beginner at Rails.

I'm coding CSS in my sample application. I understand there is Javascript code to help browsers, i.e. Internet Explorer, support HTML5.

What is the difference between HTML5 Shim and HTML5 Shiv? Is it something worth knowing?

http://html5shim.googlecode.com/svn/trunk/html5.js

http://html5shiv.googlecode.com/svn/trunk/html5.js

My code, y'all:

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->

Html Solutions


Solution 1 - Html

It was originally called the html5-shiv.

Shiv really isn't the right term, as a shiv is a stabbing-implement.

A shim is something which you use to level things out (or prop them up). If a table has one leg that's too short, you might shim it with a piece of wood or a phone book...

So html5-shim is for people who expect html5shiv to be called a shim.

That's entirely it, as far as differences go.

Kind of like polyfills cover over the differences in implementations of features.
In North America, Polyfill might be called "Spackle".

Solution 2 - Html

From http://code.google.com/p/html5shim/

> shiv or shim? > > Common question: what's the difference between the html5shim and the html5shiv?
> Answer: nothing, one has an m and one has a v - that's it.

Solution 3 - Html

The answer is.

> The term shiv originates from John Resig, who was thought to have used > the word for its slang meaning, a sharp object used as a knife-like > weapon, intended for Internet Explorer. Truth be known, John probably > intended to use the word > shim, which in > computing means an application compatibility workaround. Rather than > correct his mispelling, most developers familiar with Internet > Explorer appreciated the visual imagery. And that, kids, is etymology.

From author's page at https://github.com/aFarkas/html5shiv

Solution 4 - Html

This is probably more simple than you're looking for, but for others who may be confused:

First, here's a non-programming definition of a Shim:

>noun: a washer or thin strip of material used to align parts, make them fit, or reduce wear. > >verb: wedge (something) or fill up (a space) with a shim.

To understand a shim in programming terms, you need to understand what a pain IE was/is for web developers:

IE was one of the first commercially-available web browsers. And it may have been the first one available "for free". Thus, it was built before browser standards were defined, ie definitions of how to handle html and javascript.

So, in order to keep sites and applications working in IE, as standards were produced, IE could not or (for monopolistic reasons) would not update IE (here's a great post with more info about that). This caused a rift between IE and other browsers that grew over time. This rift often surfaced in unexpected errors, styling differences, and some applications straight-up refused their users the option of running it from other browsers.

But, if a product was going to be available for both types of browser, developers often had to write two sets of code. One for practically every modern browser, and one for IE. Obviously, this practice made upkeep a nightmare. But, as time progressed, many JavaScript frameworks/libraries started adding code to specifically address these issues. These pieces of code are known as shims. Because they're making your code "fit" in IE.

For instance, when jQuery was first released, a major advantage it had over its predecessors - or just writing your own library - was that it worked in every Browser, even IE. At the time IE was still heavily used, so this saved developers a lot of time. But now jQuery is on version 3. And the major difference between previous versions is that it no longer supports IE. That's because everyone, even Microsoft has sorta moved away from IE (Win10's default browser is Edge). But, unfortunately many sites and web applications were designed specifically for IE (for security reasons). And even though IE has gone the way of the Dodo for most commercial applications, it still offers security features that other browsers don't (but they're catching up quickly). And even if they did, the cost of updating these applications is often too great to be justifiable.

And that basically means many people still are forced to use IE, so these shims are still necessary.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionowlstoneView Question on Stackoverflow
Solution 1 - HtmlNorguardView Answer on Stackoverflow
Solution 2 - HtmlSander LuísView Answer on Stackoverflow
Solution 3 - HtmlAdriano RosaView Answer on Stackoverflow
Solution 4 - HtmlTravis HeeterView Answer on Stackoverflow