Giter VIP home page Giter VIP logo

es5-dom-shim's Issues

Date constructor null

If you include a.js and run this code:
var myNumber = 42,
myString = "42",
myArray = [41, 42, 43],
myBoolean = true,
myDate = new Date();

console.log(typeof myNumber);
console.log(typeof myString);
console.log(typeof myArray);
console.log(typeof myBoolean);
console.log(typeof myDate);

console.log(myNumber.constructor);
console.log(myString.constructor);
console.log(myArray.constructor);
console.log(myBoolean.constructor);
console.log(myDate.constructor);

if (myArray.constructor == Array) {
console.log("We found an array");
}

Then console.log(myDate.constructor); logs:
null

Running the code without the library logs:
Date()

What is causing this and how can it be overcome?

fix [set/get/remove]Attribute

MDSN:
getAttribute method
setAttribute method
removeAttribute method

For resolve problems with properties and attributes in IE < 8, we can use second parameter in [get/remove]Attribute and third parameter in setAttribute.

var div = document.createElement("div");
div.testValue = 666;
div.setAttribute("testValue", "lolcat");
console.log("property value: " + div.testValue, " ", "attribute value: " + div.getAttribute("testValue"));

div.testValue = 666;
div.setAttribute("TESTVALUE", "lolcat", 1);
console.log("property value: " + div.testValue, " ", "attribute value: " + div.getAttribute("TESTVALUE", 1));

FF failder Object.getOwnPropertyDescriptor

Object.getOwnPropertyDescriptor(KeyboardEvent.prototype, "location")

throw Error: Illegal operation on WrappedNative prototype object

Object.getOwnPropertyDescriptor(document.__proto__, "firstChild")

throw Error: Could not convert JavaScript argument

After the first call to this lookupGetter, function Object.getOwnPropertyDescriptor begins to work.

KeyboardEvent.prototype.__lookupGetter__("location");
Object.getOwnPropertyDescriptor(KeyboardEvent.prototype, "location");
document.__proto__.__lookupGetter__("firstChild");
Object.getOwnPropertyDescriptor(document.__proto__, "firstChild");

Android 2.3.3–2.3.5 defineProperty exception

defineProperty при попытке добавить свойство remove для HTMLSelectElement.prototype выбрасывает исключение: «can not redefine property».
Тестировал на следующих устройствах устройствах: Samsung Galaxy Ace GT-5830 (Android 2.3.3) и HTC Wildfire (Android 2.3.5).

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.