make ie browser like a morden browser main for ie6~ie8,

Overview

ieBetter.js

It's created for IE6-IE8.

Why need this?

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

So, what we need is just a JavaScript file which 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 ignored. 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://zhangxinxu.github.io/ieBetter.js/

Still, you can visit here for some other information.

License

The MIT License

Donate

支付宝 微  信
You might also like...

The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

Oct 17, 2022

This is a website for creating to-do tasks. "To-do list" is a tool that helps to organize your day. The main objective is to understand how to use proper ES6 syntax.

TO DO LIST To Do List This is a website for creating to-do tasks. "To-do list" is a tool that helps to organize your day. This project is part of the

Oct 3, 2022

This project will be a basic website that allows users to add/remove books from a list. The main objective is to understand how to use JavaScript objects and arrays and dynamically modify the DOM and add basic events.

Awesome-books Awesome Books This project will be a basic website that allows users to add/remove books from a list. This project is part of the Microv

Oct 3, 2022

The main aim of the package is to parse Primavera xer files

This package is part of the Planner Toolkit open source project. The main aim of the package is to parse Primavera xer files. The project is open source and can be found here.

Sep 25, 2022

The awesomebooks project is a simple list, but separated into 3 parts and given a retro feel. The main page is where we can add books, and on another page we can see the list, and remove items. There is also a "contact-us" page.

Awesome Books This is the restructured version of the famous awesome-books project! Here you can find JavaScript broken into modules, using import-exp

Nov 15, 2022

A library for boolean aliases to help you make your code more confusing and make your coworkers hate you.

yup-nope A library for boolean aliases to help you make your code more confusing and make your coworkers hate you. Installation Using npm: npm install

Dec 10, 2022

why make apps to increase focus -- when you can make apps to reduce focus

impossifocus 🕺 What is this? ImpossiFocus will measure focus by reading your brainwaves -- and if you're in the zone, it'll ensure that changes with

Nov 30, 2022

Notes may contain grammatical errors and some wont make sense and will only make sense to me

Notes may contain grammatical errors and some wont make sense and will only make sense to me

This is my own notes containing all the information and knowledge I've gained during my studying sessions. The notes are all topics that relates to technology such as computers, software or programming.

Dec 15, 2022
Comments
  • Create package.json for package informateion

    Create package.json for package informateion

    Hi, @zhangxinxu

    Your great work had been recommend being added in cdnjs. However, we need more confirmed information when include it in our project. Would you mind to add package.json for the package :)? And we would appreciate your help. #5737

    Thank you! Piicksarn

    opened by Piicksarn 4
  • 建议发布版本的时候使用 github release功能

    建议发布版本的时候使用 github release功能

    a workflow for shipping software to end users. Releases are first-class objects with changelogs and binary assets that present a full project history beyond Git artifacts.

    具体操作, 请参考Release Your Software

    opened by ufologist 1
  • Update ieBetter.js

    Update ieBetter.js

    Wrong behavior of getElementsByClassName. See https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-getelementsbyclassname for details.

    opened by myst729 1
Releases(v1.0.4)
Owner
zhangxinxu
love fishing, writing and sharing. new toys move to https://gitee.com/zhangxinxu
zhangxinxu
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
this project's main aim is to restructure Awesome books app code to make it more organized by using modules and also practicing the ES6 syntax.

Awesome Books ES6 this project's main aim is to restructure Awesome books app code to make it more organized by using modules. also practicing the ES6

PRATAP PANABAKA 7 Sep 6, 2022
A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebWorker like neither of those.

Amuchina A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebW

Fabio Spampinato 9 Sep 17, 2022
Functions Recipes is a library of examples to help you getting started with Salesforce Functions and get used to their main features.

Functions Recipes Introduction Salesforce Functions lets you use the Salesforce Platform for building event-driven, elastically scalable apps and expe

Trailhead Apps 172 Dec 29, 2022
This is the main repository for NFT collection dao smart contracts.

Basic Sample Hardhat Project This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample s

null 3 Apr 11, 2022
An interactive app that allows adding, editing and removing tasks of a to-do list. Drag-and-drop featured added. Webpack was used to bundle all the Js modules in to one main Js file.

To-do List A to-do list app This app let you to set your own to-do list. Built With HTML CSS JavaScript WebPack Jest Live Page Page Link Getting Start

Kenny Salazar 7 May 5, 2022
Main Site for the Huff Language.

Huff UI A simple landing page for the Huff Language. Get Started Install yarn if you haven't already: npm i -g yarn Install dependencies and start the

Huff 7 Jul 26, 2022
The main repository for Youarerad.org

Welcome to Rise Above The Disorder's Website Repo! We are a non-profit covering the cost of mental health care for people all over the world. Original

Rise Above The Disorder 67 Jan 3, 2023