-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
241 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |