inexorabletash / polyfill Goto Github PK
View Code? Open in Web Editor NEWJavaScript Polyfills, Shims and More
License: Other
JavaScript Polyfills, Shims and More
License: Other
Per 2013-09-19 TC-39
I was rather excited to see an up-to-date KeyboardEvent polyfill, but was surprised that key
was not implemented.
Firefox 37 is set to support this properly and chrome just had a commit a couple days ago in master, so this is still not widely supported. I see that char
and code
are supported, but key
feels a lot more natural in my application.
It would be nice to have this.
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library inexorabletash/polyfill
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "inexorabletash/polyfill",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
Hello,
can you check out the Uint8Array because when I use it to convert a pdf file with this steps:
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
IE9 crashes when executing this line:
var ia = new Uint8Array(ab);
PS: ArrayBuffer works great.
Thanks
var SameValue = Object.is;
ObjectCreate
's second argument is sketchyJust askin, maybe I'm using it wrong but I get Obj.dataset undefined in IE8 in compatibility mode Windows8.
23 July 2013 TC39 consensus:
Cannot get it to work with getter and setter, earlier it works
var map = new Map();
map.set('a', 1);
map.set('b', 2);
map.set('c', 3);
map.set('d', 4);
var keys = [];
var iterator = map.keys();
keys.push(iterator.next());
map["delete"]('a');
map["delete"]('b');
map["delete"]('c');
map.set('e');
keys.push(iterator.next());
keys.push(iterator.next());
console.log(keys);
this code throws StopIteration, but according to spec keys should be equal to ['a', 'd', 'e']
Recently I changed from defineFunctionProperty(obj, name, func) to just (obj, func) and using func.name for name. Turns out this is non-standard - need to revert that change.
Hi!
“Public Domain” is not a licence, and is questionable in some places. Would you be willing to add the following to the licence file:
「In countries where the Public Domain status of the work may not be valid, its author hereby grants a copyright licence to the general public to deal in the work without restriction and permission to sublicence derivates under the terms of any (OSI approved) Open Source licence.」
That would enable us Europeans to use your code. Thanks!
var minFloat32 = 1.401298464324817e-45;
var truncated = packFloat32(unpackFloat32(-minFloat32 / 2 - Math.pow(2, -202)));
assert(truncated == -minFloat32) // fails
I don't understand the math at all, I've just collected some test cases :-/ so thanks for reasoning through it for me :-)
clear
methods eliminatedString.prototype.contains
renamed to String.prototype.includes
RegExp.prototype
RegExp.prototype.flags
for accessing flags string. Facilitates RegExp subclasses that add flags.new RegExp(aRegExp, flags)
no longer throws. Instead clones first argument but with supplied flags.
this
binding evaluates to undefined
.
Array.isArray(new Proxy([ ], { }))
returns true.
let derived = new obj.constructor.species();
25 July 2013 TC39 consensus
The implementations of the extras (from()
, slice()
etc) depend on getters/setters which aren't available in IE8.
This could be fixed by implementing them in JS w/o relying on Array extras, using _getter and _setter.
es6.js, 259 line:
Uncaught TypeError: Cannot convert a Symbol value to a string
assert(symbolForKey(String(global.Symbol('x'))));
I have this error in Chrome 37.0.2054.3 dev (and 37.0.2062.3 dev).
I don't have this error in Firefox 33.0a1, iOS 7.1.1's Safari.
If I comment this line, I get the same error in another line.
I found that Chrome now provides its own (i.e. without polyfills) Symbol:
typeof Symbol === 'function' (it is 'undefined' in other browsers)
typeof Symbol('x') === 'symbol'
Symbol('x').toString() === 'Symbol(x)'
Per TC39, Number.prototype.clz() => Math.clz32()
Current ES7 proposal: https://github.com/domenic/Array.prototype.contains/
If Symbol() hack generates identifiable strings, can shim getOwnPropertyNames and getOwnPropertySymbols to filter them appropriately.
23 July 2013 TC39 consensus
(wait for spec; unsure if this should be Math, Number.prototype)
Add the ES7 proposals being championed:
ES7 proposals now tracked at: https://github.com/tc39/ecma262
And should probably:
es7.js
to experimental
folderhttps://github.com/inexorabletash/polyfill/blob/master/harmony.js#L2697
Returns the value; per spec it should be returning the map itself to allow chaining e.g. wm.set(...).set(...)
Per July 25 2013 TC39, redundant w/ Math.trunc()
https://github.com/tc39/agendas/blob/master/2014/04.md
@@iterator
on arguments object (bug)%TypedArray%
constructors accept iterable / Do string coercion to number before handling iterable to avoid mishandling a string argument.forEach
callback signature to: value, indexObject.assign
gets multiple source objectshi, for firefox, the code seems to use the KeyboardEvent.key
property if existing, but that one isn’t supported fully.
e.g. firefox uses (until version 37 lands) "Down"
instead of "ArrowDown"
etc.
XMLHttpRequest, in the latest specs and browsers, supports more events than "readystatechange" (namely "error", "abort", "timeout", and "load"), and supports adding listeners using addEventListener rather than just setting the "onreadystatechange" property: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Events
It would be nice if web developers could have a polyfill that allows us to rely on the presence of these events and not worry about our code breaking on IE9.
Array.from etc.
Values out of range do not generate infinities, so unpackFloat32(packFloat32(1e308)) doesn't produce Infinity
Hi!
I'm working on an asmjs project, and I tried to use your typedarray.js
where TypedArrays are not supported. But when I run the project, the older browsers stop responding.
var space = 4*1024*1024; // 4MB
var MEM = new ArrayBuffer(space);
(function(stdlib, foreign, heap) {
"use asm";
var HEAP8 = new stdlib.Uint8Array(heap);
function main() {
// ...
}
return {main:main};
}(window, {}, MEM)).main();
Can I use the polyfill with Modernizr? I'm a bit confused as to what it actually does compared to your polyfill. I believe it's gonna be like this: I only need CSS selectors and CSS3 support, so only the first tab, your polyfill would probably include the HTML, DOM, EVENTS parts.
I just decided to go Native JS, I read left and right and feel very scared+amazed there is freedom.. so I speak a bit n00b-ish, sorry.
From spec
1.
Constructor(USVString url, optional USVString base = "about:blank")
If url is failure, return failure.
In other words new URL('')
should throw an exception like Firefox
Per July 25, 2013 TC39
Unclear whether there was consensus.
...but one issue with wojodesign's code is that it doesn't distinguish keys very well. For example: "A-B-C" and "a-b-c" and "A%B*C" would be treated as the same key.
(I think I submitted a patch.)
function locate(lat, long) {
var map = $("#map");
var x = map.offsetWidth * ((long + 180) % 360) / 360;
var y = map.offsetHeight * (90 - lat) / 180;
var locator = $("#locator");
locator.style.display = '';
// Error: No se puede obtener la propiedad 'style' de referencia nula o sin definir
// Error: Unable to get the 'style' property null reference or undefined
locator.style.left = String(x) + 'px';
locator.style.top = String(y) + 'px';
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.