Questions tagged [es5-shim]

Support for ECMAScript5 (ES5) on older browsers (mainly pre IE9). The ES5 specification was published in 2009.

Support for ECMAScript5 (ES5) on older browsers (mainly pre IE9). The ES5 specification was published in 2009.

Compatibility table https://kangax.github.io/compat-table/es5/

56 questions
101
votes
3 answers

Requirejs why and when to use shim config

I read the requirejs document from here API requirejs.config({ shim: { 'backbone': { //These script dependencies should be loaded before loading //backbone.js deps: ['underscore', 'jquery'], …
Anil Gupta
  • 2,329
  • 4
  • 24
  • 30
37
votes
3 answers

How to provide ECMAScript 5 (ES 5)-shim?

ECMAScript Fifth Edition (released December 2009) introduces a bunch of new methods (see this table for details). However, there still are older browsers out there which do not implement those new methods. Luckily, there exists a convenient script…
Šime Vidas
  • 182,163
  • 62
  • 281
  • 385
14
votes
2 answers

Typescript Map throwing error while using its functions (mapobject.keys() is not a function)

I am a new bee in typescript , In my angular4 project I am receiving a map object as a json. so I declared a class that is given bellow export class FormConfig { public id: number; public name:…
Vishnu KR
  • 718
  • 1
  • 8
  • 22
6
votes
1 answer

Injecting a javascript polyfill onto a page with Selenium & PhantomJS

There has been a lot of discussion here and elsewhere about PhantomJS's lack of a Function.prototype.bind method, and a lot of helpful philanthropists have written shims/polyfills or pointed others to those resources. I'm implementing PhantomJS via…
Magenta Nova
  • 691
  • 1
  • 9
  • 15
6
votes
1 answer

Why doesn't MDN's `Object.create` polyfill set `prototype.constructor`?

Considering MDN's Object.create polyfill: if (typeof Object.create != 'function') { (function () { var F = function () {}; Object.create = function (o) { if (arguments.length > 1) { throw Error('Second argument not supported');} …
ChaseMoskal
  • 7,151
  • 5
  • 37
  • 50
5
votes
2 answers

Migrating es5 to es6 export default

I am trying to migrate a code from es5 to es6, I am quite new in both, if someone could help me, I will be very thankful. es5 version: lib.js module.exports = { foo1: function () { this.foo2() { ... } }, …
Kelyane
  • 467
  • 2
  • 7
  • 19
5
votes
1 answer

date pipe issue on IE10 - 'Intl' is undefined

I have the following simple example that uses the Angular 2 date pipe which works fine in IE11 but fails on IE10: @Component({ selector: 'my-app', template: 'my date: {{ myDate | date }}' }) export class AppComponent { myDate: Date = new…
Niner
  • 2,074
  • 6
  • 37
  • 47
5
votes
1 answer

Object.defineProperty polyfill

I am currently writing a JavaScript API which is based on new features in ES5. It uses Object.defineProperty quite extensively. I have wrapped this into two new functions, called Object.createGetSetProperty and Object.createValueProperty I am…
Matthew Layton
  • 39,871
  • 52
  • 185
  • 313
4
votes
2 answers

What is alternative before ES6 of getter method existing in ES6

Getter method in ES6 is defined as METHOD & called as ATTRIBUTE (calling obj.method instead of obj.method(..)) Example : class Job { constructor(){ this.start=new Date(); } get age(){ return new Date()-this.start; …
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
4
votes
2 answers

es5-shim and underscore.js?

I have both es5-shim.js and underscore.js in my JavaScript project. es5-shim.js just add some javascript native functions like reduce and some on arrays for Internet Explorer and some old browsers. underscore.js add the same thing (but with a…
Magus
  • 14,796
  • 3
  • 36
  • 51
3
votes
3 answers

Why would you pass a global variable to a function?

I've seen the same code written both ways and wonder if there's any tradeoff between them. Method 1: (function(i) { // Do something to i now }(global_variable)) Method 2: (function() { // Do something to global_variable now }()) Why would…
CamJohnson26
  • 1,119
  • 1
  • 15
  • 40
3
votes
1 answer

IE11 issue Angular CLI project in Angular2(TS), polyfills are notworking

I am using anugular-cli 1.0.0-beta.16 which has polyfills.ts which looks like this: // This file includes polyfills needed by Angular 2 and is loaded before // the app. You can add your own extra polyfills to this file. import…
ruksad
  • 33
  • 1
  • 7
3
votes
5 answers

Return all the values of an array in json

I have a json with all posts my blog and I wanna to return all the values of "tags" array. So, see the json example below: "posts":[ { "id":"89319077059", "title":"Post Title 01", "tags":[ "Politcs", "Science", …
Tiago Barreto
  • 822
  • 13
  • 31
3
votes
1 answer

bind polyfill for PhantomJS

I am trying to add bind polyfill in my phantomjs file using es5-shim.js. I have tried to include es5-shim.js using require(), but I am still getting error when I execute the phantomjs file. What is the correct way to use this?
Erwin
  • 1,762
  • 3
  • 24
  • 30
2
votes
0 answers

White screen on emulator and device because of es6 code not transpiled android 5.1.1

I'm doing an ionic project using cordova for an android app, while deploying on android version 5.1 , i'm getting some syntax erros : Uncaught Syntax error : unexpected token Uncaught Syntax error : WebpackJsonp not defined I changed the target…
1
2 3 4