{"id":26111444,"url":"https://github.com/shawnbot/aight","last_synced_at":"2025-05-16T18:05:15.620Z","repository":{"id":2782314,"uuid":"3781859","full_name":"shawnbot/aight","owner":"shawnbot","description":"JavaScript shims and shams for making IE8-9 behave reasonably","archived":false,"fork":false,"pushed_at":"2016-10-18T14:03:07.000Z","size":1401,"stargazers_count":756,"open_issues_count":6,"forks_count":98,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-10T10:48:38.157Z","etag":null,"topics":["dom","ie8","ie9","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shawnbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-21T00:32:59.000Z","updated_at":"2024-12-18T09:45:40.000Z","dependencies_parsed_at":"2022-08-29T00:11:09.383Z","dependency_job_id":null,"html_url":"https://github.com/shawnbot/aight","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnbot%2Faight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnbot%2Faight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnbot%2Faight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnbot%2Faight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shawnbot","download_url":"https://codeload.github.com/shawnbot/aight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582903,"owners_count":22095518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom","ie8","ie9","javascript"],"created_at":"2025-03-10T01:51:31.428Z","updated_at":"2025-05-16T18:05:15.557Z","avatar_url":"https://github.com/shawnbot.png","language":"JavaScript","readme":"# \u003cimg alt=\"aight\" src=\"https://raw.github.com/shawnbot/aight/master/assets/aight.png\"\u003e\n\n\u003cimg src=\"https://travis-ci.org/shawnbot/aight.svg\" alt=\"travis build status\"\u003e [![CDNJS](https://img.shields.io/cdnjs/v/aight.svg)](https://cdnjs.com/libraries/aight)\n\nAight is a collection of shims and polyfills that get IE8 (and IE9) up to speed\nwith a bare minimum of HTML5 compatibility, providing all of the interfaces\nnecessary to do HTML-only[*](#svg) DOM manipulation with [D3](http://d3js.org)\nand other libraries that rely on them. It includes:\n\n* [es5-shim](https://github.com/kriskowal/es5-shim), which implements all of\n  the Array prototype methods in the ES5 spec, and other goodies. Both the\n  [shims](https://github.com/es-shims/es5-shim#shims) and\n  [shams](https://github.com/es-shims/es5-shim#shams) are included.\n\n* The [ie8](https://github.com/WebReflection/ie8) and\n  [dom4](https://github.com/WebReflection/dom4) collections, courtesy of\n  [Andrea Giammarchi](https://github.com/WebReflection). My\n  [fork of ie8](https://github.com/shawnbot/ie8/tree/ie9) maintains\n  compatibility with IE9, and dom4 provides Event and DOM JavaScript interface\n  compatibility for *any* browser.\n\n* A simple shim for\n  [CSSStyleDeclaration](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration)'s\n  `setProperty()` and `removeProperty()` methods.\n\n* A shim for [document.createElementNS()](http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS),\n  which throws an error if you pass it an actual namespace (which IE8 doesn't\n  support). This merely provides a facade of interoperability with D3, which\n  calls `document.createElementNS()` even in cases where the parent's\n  namespaceURI is undefined (as is the case in HTML5, but *not* XHTML).\n\n* [html5shiv](https://github.com/aFarkas/html5shiv/), which monkeypatches IE6-8\n  to enable manipulation of HTML5 elements in the DOM and applies basic styling\n  for them in IE6-9. *If you need to be able to print these elements* you will\n  need to bring your own\n  [html5shiv-printshiv.js](https://github.com/aFarkas/html5shiv/#html5shiv-printshivjs).\n\n* An [IE8-friendly build](#d3-ie8) of [D3](http://d3js.org).\n\n## Installation\nYou have some options:\n\n1. Download [the latest release](https://github.com/shawnbot/aight/releases)\nor grab the latest from [GitHub](https://github.com/shawnbot/aight):\n    ```sh\n    curl -O https://raw.githubusercontent.com/shawnbot/aight/master/aight.js\n    # or minified:\n    curl -O https://raw.githubusercontent.com/shawnbot/aight/master/aight.min.js\n    ```\n\n1. Clone [this repository](https://github.com/shawnbot/aight) with git:\n    ```sh\n    git clone https://github.com/shawnbot/aight.git\n    ```\n\n1. Install with [bower](http://bower.io/):\n    ```sh\n    bower init # if you haven't already\n    bower install aight#~2.0\n    # then copy it from the bower_components directory\n    cp bower_components/aight/aight*.js path/to/js\n    ```\n\n1. Install with [npm](https://www.npmjs.com/package/aight):\n    ```sh\n    npm install aight\n    # then copy it from the node_modules directory\n    cp node_modules/aight/aight*.js path/to/js\n    ```\n\n## Usage\nFirst off, ensure that you're using the [right\nDOCTYPE](http://ejohn.org/blog/html5-doctype/) in your HTML:\n\n```html\n\u003c!DOCTYPE html\u003e\n```\n\nAnd in your `\u003chead\u003e`, include the following `\u003cmeta\u003e` tag:\n\n```html\n\u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"\u003e\n```\n\nThese two steps ensure that IE8 will run in [standards\nmode](http://en.wikipedia.org/wiki/Internet_Explorer_8#Standards_mode).\nFinally, include `aight.min.js` (or the un-minified version, `aight.js`, if\nyou're debugging aight itself) in a [conditional\ncomment](http://www.quirksmode.org/css/condcom.html) inside the `\u003chead\u003e`:\n\n```html\n\u003c!--[if lte IE 9]\u003e\n\u003cscript src=\"aight.min.js\"\u003e\u003c/script\u003e\n\u003c![endif]--\u003e\n```\n\nBringing it all together, you end up with:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"\u003e\n    \u003c!--[if lte IE 9]\u003e\n    \u003cscript src=\"aight.min.js\"\u003e\u003c/script\u003e\n    \u003c![endif]--\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nFor your convenience, this snippet is included with aight in `template.html`.\n\n## D3 for IE8 \u003ca name=\"d3-ie8\"\u003e\u003c/a\u003e\nIE8 barfs on [some parts](https://github.com/mbostock/d3/pull/2209) of\n[D3](http://d3js.org)'s JavaScript. The included `d3.ie8.js` and minified\n`d3.ie8.min.js` (in the `d3` directory) are IE8-friendly builds of\n[d3.v3.js](http://d3js.org/d3.v3.js) with shams for some CSS properties, namely\n`opacity`. You'll need to tweak your HTML to use these, e.g.:\n\n```html\n\u003c!--[if lte IE 9]\u003e\u003cscript src=\"aight.js\"\u003e\u003c/script\u003e\u003c![endif]--\u003e\n\u003cscript src=\"http://d3js.org/d3.v3.min.js\"\u003e\u003c/script\u003e\n\u003c!--[if IE 8]\u003e\u003cscript src=\"d3.ie8.js\"\u003e\u003c/script\u003e\u003c![endif]--\u003e\n```\n\nSince conditional comments are inaccessible to other browsers, we\nhave to download the \"modern\" d3.js (which will throw errors in IE8)\n*and* the shimmed one (which won't). It's an imperfect solution,\nobviously. You *may* serve `d3.ie8.js` to modern browsers, but there\nwill probably be performance implications depending on how you use\nD3.\n\n## What about SVG? \u003ca name=\"svg\"\u003e\u003c/a\u003e\nShimming SVG support is tricky business. If you need to support IE8, my\nsuggestion is either to [degrade gracefully](https://www.google.com/search?q=graceful%20degradation)\nusing HTML elements or to try one of the following:\n\n- [Raphaël](http://raphaeljs.com/), the SVG-friendly abstraction that falls\n  back to VML support in IE8.\n- [r2d3](https://github.com/mhemesath/r2d3/) uses Raphaël under the hood to\n  provide SVG rendering support to [D3](http://d3js.org).\n- [svgweb](https://code.google.com/p/svgweb/) is a Flash-based SVG renderer.\n  This is **beta** software which lacks full SVG 1.1 support and will not allow\n  you to style SVG with CSS.\n\nIE9 has [great SVG support](http://blogs.msdn.com/b/ie/archive/2010/03/18/svg-in-ie9-roadmap.aspx),\nthough.\n\n## aight: the command line tool\nAs of version 2.0.5, aight comes with a handy command-line script that rewrites\nJavaScript (specifically, the stuff that shims and shams can't reach) to be\nIE8-friendly. Just install aight via [npm](https://www.npmjs.com/package/aight):\n\n```sh\nnpm install -g aight\n# leave off the -g to install locally\n```\n\nThen run `aight` and give it a JavaScript filename (or source via stdin), and\nit will print JavaScript to stdout:\n\n```sh\naight modern.js \u003e ie8-friendly.js\ncat modern.js | aight \u003e ie8-friendly.js\n```\n\nYou can see how it works by piping in a simple `for..in` loop:\n\n```sh\necho \"var obj = {}; for (var key in obj) console.log(key, obj[key]);\" | aight\n```\n\nwhich outputs (with whitespace, for clarity):\n\n```js\nvar obj = {};\nfor (var key in obj) if (obj.hasOwnProperty(key)) {\n  console.log(key, obj[key]);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawnbot%2Faight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawnbot%2Faight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawnbot%2Faight/lists"}