Skip to content

Commit

Permalink
Initial and hopefully final release
Browse files Browse the repository at this point in the history
  • Loading branch information
syranide committed Jul 20, 2014
1 parent 459c078 commit 32ecfe4
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 5 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Andreas Svensson
Copyright (c) @syranide

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
58 changes: 55 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,56 @@
shivie8
=======
# shivIE8 1.0.0

Minimal HTML5 shiv for IE8
Minimal HTML5 element shiv for IE8. Forked from [html5shiv](https://github.com/aFarkas/html5shiv).
Only 347 bytes uncompressed, 265 bytes compressed!

This is a vastly simplified fork of [html5shiv](https://github.com/aFarkas/html5shiv) that focuses only on supporting HTML5 elements for IE8 (supported natively by IE9). IE8 is still prevalent enough that many can't afford to ignore it and many frameworks explicitly advertise support for IE8. Many frameworks (like [React](https://github.com/facebook/react)) do not include the HTML5 elements shiv for IE8.

IE Quirks and IE6+ are also supported by this shiv. FireFox 3+ and Safari 4+ have no inherent issues with HTML5 elements when used with the shiv stylesheet below.

*IE8 is the last of a plagued breed, due to the extremely limited scope and simplicity of this workaround, expect this to be the last and final release... unless an issue is discovered.*

## Use this stylesheet

This script does NOT attach a stylesheet with default styles for HTML5 elements. Instead, copy the CSS below and put it at the top of your base/reset stylesheet, customize as you please.

```
article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section {
display: block;
}
mark {
background: #FFFF00; color: #000000;
}
template {
display:none;
}
```

## Use as script

Shivs `document` on load, call `shivIEDocumentElements(otherDocument)` if necessary.

```
<script src="shivie8.min.js"></script>
```

## Use as module

Shivs `document` on require, call `shivIEDocumentElements(otherDocument)` if necessary.

```
// dist/amd/shivie8.js
define(['shivie8'], function(shivIEDocumentElements) {
shivIEDocumentElements(document);
});
```
```
// dist/commonjs/shivie8.js
// npm install shivie8
// bower install --save shivie8
var shivIEDocumentElements = require('shivie8');
shivIEDocumentElements(document);
```

## Template danger

`<template>` is not reliable as its content is always evaluated by IE8. Reading from its `innerHTML` is also **unsafe** in IE8 due to insufficient escaping, white-space is also not correctly preserved. User supplied data in `template` is likely susceptible to XSS, use `<script type="text/plain">` instead.
18 changes: 18 additions & 0 deletions dist/amd/shivie8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*! shivie8 | @syranide | MIT license */

define(function() {
var shivIEDocumentElements;
return (shivIEDocumentElements = function(doc) {
if (doc.documentMode < 9) {
for (
var tagNames = (
'abbr,article,aside,audio,bdi,canvas,data,datalist,details,dialog,' +
'figcaption,figure,footer,header,hgroup,main,mark,meter,nav,output,' +
'picture,progress,section,summary,template,time,video'
).split(',');
tagNames[0];
doc.createElement(tagNames.pop())
);
}
})(document), shivIEDocumentElements;
});
2 changes: 2 additions & 0 deletions dist/amd/shivie8.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dist/commonjs/shivie8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*! shivie8 | @syranide | MIT license */

(module.exports = function(doc) {
if (doc.documentMode < 9) {
for (
var tagNames = (
'abbr,article,aside,audio,bdi,canvas,data,datalist,details,dialog,' +
'figcaption,figure,footer,header,hgroup,main,mark,meter,nav,output,' +
'picture,progress,section,summary,template,time,video'
).split(',');
tagNames[0];
doc.createElement(tagNames.pop())
);
}
})(document);
2 changes: 2 additions & 0 deletions dist/commonjs/shivie8.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dist/shivie8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*! shivie8 | @syranide | MIT license */

(function shivIEDocumentElements(doc) {
if (doc.documentMode < 9) {
for (
var tagNames = (
'abbr,article,aside,audio,bdi,canvas,data,datalist,details,dialog,' +
'figcaption,figure,footer,header,hgroup,main,mark,meter,nav,output,' +
'picture,progress,section,summary,template,time,video'
).split(',');
tagNames[0];
doc.createElement(tagNames.pop())
);
}
})(document);
2 changes: 2 additions & 0 deletions dist/shivie8.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions npm-shivie8/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) @syranide

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 40 additions & 0 deletions npm-shivie8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# shivIE8 1.0.0

Minimal HTML5 element shiv for IE8. Forked from [html5shiv](https://github.com/aFarkas/html5shiv).
Only 347 bytes uncompressed, 265 bytes compressed!

This is a vastly simplified fork of [html5shiv](https://github.com/aFarkas/html5shiv) that focuses only on supporting HTML5 elements for IE8 (supported natively by IE9). IE8 is still prevalent enough that many can't afford to ignore it and many frameworks explicitly advertise support for IE8. Many frameworks (like [React](https://github.com/facebook/react)) do not include the HTML5 elements shiv for IE8.

IE Quirks and IE6+ are also supported by this shiv. FireFox 3+ and Safari 4+ have no inherent issues with HTML5 elements when used with the shiv stylesheet below.

*IE8 is the last of a plagued breed, due to the extremely limited scope and simplicity of this workaround, expect this to be the last and final release... unless an issue is discovered.*

## Use this stylesheet

This script does NOT attach a stylesheet with default styles for HTML5 elements. Instead, copy the CSS below and put it at the top of your base/reset stylesheet, customize as you please.

```
article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section {
display: block;
}
mark {
background: #FFFF00; color: #000000;
}
template {
display:none;
}
```
## Use as module

Shivs `document` on require, call `shivIEDocumentElements(otherDocument)` if necessary.

```
// npm install shivie8
// bower install --save shivie8
var shivIEDocumentElements = require('shivie8');
shivIEDocumentElements(document);
```

## Template danger

`<template>` is not reliable as its content is always evaluated by IE8. Reading from its `innerHTML` is also **unsafe** in IE8 due to insufficient escaping, white-space is also not correctly preserved. User supplied data in `template` is likely susceptible to XSS, use `<script type="text/plain">` instead.
27 changes: 27 additions & 0 deletions npm-shivie8/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "shivie8",
"title": "shivIE8",
"version": "1.0.0",
"author": "Andreas Svensson <[email protected]>",
"description": "Minimal HTML5 element shiv for IE8",
"homepage": "https://github.com/syranide/shivie8",
"bugs": "https://github.com/syranide/shivie/issues",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/syranide/shivie8"
},
"keywords": [
"html5shiv",
"html5shim",
"html5",
"oldie",
"ie8",
"shiv",
"shim"
],
"engines": {
"node": ">=0.10.0"
},
"main": "shivie8.js"
}
15 changes: 15 additions & 0 deletions npm-shivie8/shivie8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*! shivie8 | @syranide | MIT license */

(module.exports = function(doc) {
if (doc.documentMode < 9) {
for (
var tagNames = (
'abbr,article,aside,audio,bdi,canvas,data,datalist,details,dialog,' +
'figcaption,figure,footer,header,hgroup,main,mark,meter,nav,output,' +
'picture,progress,section,summary,template,time,video'
).split(',');
tagNames[0];
doc.createElement(tagNames.pop())
);
}
})(document);
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "shivie8",
"title": "shivIE8",
"version": "1.0.0",
"author": "Andreas Svensson <[email protected]>",
"description": "Minimal HTML5 element shiv for IE8",
"homepage": "https://github.com/syranide/shivie8",
"bugs": "https://github.com/syranide/shivie/issues",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/syranide/shivie8"
},
"keywords": [
"html5shiv",
"html5shim",
"html5",
"oldie",
"ie8",
"shiv",
"shim"
],
"engines": {
"node": ">=0.10.0"
},
"main": "npm-shivie8/shivie8.js"
}

0 comments on commit 32ecfe4

Please sign in to comment.