Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Lightweight ES5 and DOM shim with IE6 and IE7 support
JavaScript
branch: issue-5

This branch is 34 commits behind 0.8

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
DOCS
__COMPILE
__SRC
example
extras
tests/new
.gitignore
README.md

README.md

ES5 and DOM4 shim for all browsers with IE6 and IE7 support

based on:

Status: Stable Beta Demo Try it in IE7 (or in IE6 ¬_¬)! And take a look at the source

Goal

  • Normalizing the JS and DOM across all browsers
  • Less code (eg less closures, reusable functions) & file size
  • IE6+ support
  • Include all we need from ES5, ES6 and DOM shim in one file
  • some extra stuff (if you don't need it, use a.noextras.js instead of a.js) -

Caution !!!

  • This lib is not about performance in IE < 9
  • The a.ielt8.htc requests should respond with the mime type "text/x-component"
  • That's all cautions

Install

(Note: if you don't need EXSTRAs use a.noexstras.js instead of a.js)

  • For modern browsers: Add main script in head section

          <script src="a.js"></script>
    
  • For IE8 support:

    1. First[!] add a.ie8.js in head section

        <!--[if IE 8]>
        <script src="a.ie8.js"></script>
        <![endif]-->
      
    2. Add a.js in head section

        <script src="a.js"></script>
      
  • For IE6 and IE7, and IE8 support:

    1. Add a.ie8.js and a.ielt8.js, a.js in head section

        <!--[if lt IE 8]>
        <script src="a.ielt8.js"></script>
        <![endif]-->
        <!--[if IE 8]>
        <script src="a.ie8.js"></script>
        <![endif]-->
        <script src="a.js"></script>
      
    2. Put a.ielt8.htc to the root of your site

EXSTRAs

IF INCLUDE_EXTRAS == false -> broken Object.defineProperty will be deleted

INCLUDE_EXTRAS:

  • Exporting these objects to global (window)
    1. browser
    2. DOMStringCollection
    3. XHR from https://github.com/Raynos/xhr with customisations
  • Extending objects
    1. Object.append(object, donor, [donor2, ...])
    2. Object.extend(object, donor, [donor2, ...]) (Object.append with overwrite exists properties)
    3. Object.inherit(Child, Parent)
    4. Array.prototype.unique()
    5. String.random(length)

DEBUG

Same-domain limitation

IE requires that the .htc behavior file must be in the same domain as the HTML page which uses it. If you try to load the behavior from a different domain, you will get an "Access Denied" error. Note that the domain must be exactly the same; that means that http://www.foo.com is a different domain than http://foo.com. http://css3pie.com/documentation/known-issues/#x-domain

Solve Same-domain limitation

Russian instruction in extra/SameDomainLimitation.SOLVE_RUS.odt

Temporary testing

http://jsperf.com/es5-dom-shim-test

Known issues:

  1. Lack of test cases
  2. Same-domain limitation (can be solve only on server)
  3. Incompatibility with http://code.google.com/p/ie7-js/ [working on it]

TODO

  1. Tests
  2. http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html (https://gist.github.com/1384398 & https://gist.github.com/1235332)

License

MIT
Something went wrong with that request. Please try again.