Giter VIP home page Giter VIP logo

iebetter.js's Introduction

ieBetter.js

It's created for IE6-IE8.

Why need this?

Modern browsers are so powerfull. For some small project, this is no any reason to include a large JavaScript library. For example, jQuery, Kissy and so on.

So, what we need is just a file of JavaScript witch is created only for IE6-IE8, and make IE6-IE8 like a modern browser(Chrome, IE9+, ...).

How to use?

Simplely, include 'ieBetter.js', then just use APIs as in modern browser. For example, you can use document.querySelector to select the DOM element, and so on. The APIs that you can use see below.

document.querySelector("#id");

Because of that only IE6-IE8 need ieBetter.js. So we have to do some special deal. For Example, IE conditional comments. Like this:

<!--[if lte IE 8]>
<script src="ieBetter.js"></script>
<![endif]-->

However, IE10+ begin to ignore conditional comments. So, for this browser, if the page is in a IE6-IE8 documentMode, ieBetter.js will be ignore. So, maybe you can try this method:

if (!document.addEventListener) {
    // IE6~IE8
    document.write('<script src="ieBetter.js"><\/script>');	
}

Good luck for you!

APIs and Demos

So far, the APIs that has supported are:

• 选择器相关API
*.querySelector
*.querySelectorAll
*.getElementsByClassName

• 事件相关API
*.addEventListener
*.removeEventListener
*.dispatchEvent
document.createEvent
init[|Mouse|UI]Event
input
window.onhashchange

• DOM特性相关API
window.getComputedStyle

• ES5 JSON扩展
JSON.parse
JSON.stringify

• ES5 Object扩展
Object.create
Object.keys

• Date对象
Date.now

• ES5 Function扩展
Function.bind

• ES5 String扩展
String.trim

• ES5 数组方法扩展
Array.isArray
Array.forEach
Array.map
Array.filter
Array.some
Array.every
Array.indexOf
Array.lastIndexOf
Array.reduce
Array.reduceRight

You can visit API document to get more infomation: http://rawgithub.com/zhangxinxu/ieBetter.js/master/index.html

Still, you can visit here to some other information.

License

The MIT License

Donate

支付鼓励

iebetter.js's People

Contributors

myst729 avatar zhangxinxu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.