Processing
 

Less.js + IE8 = Object doesn't support property or method 'bind'

20/09/2016 05:54#1

Joined at: 4 months ago

Post: 1

Thank: 0

Thanked: 0

Whilst doing some cross-browser testing (using IE Edge in IE8 mode), the page fails to render correctly due to an error with Less JS (v2.7.1). The console log is:

SCRIPT438: Object doesn't support property or method 'bind' File: less.js, Line: 1896, Column: 1

Same goes for the minified version SCRIPT438: Object doesn't support property or method 'bind' File: less.min.js, Line: 13, Column: 27226

I've read that IE8 and below do not support bind hence the problem.

Can anyone offer a solution on how I can get around this issue without having to dump Less JS completely (not an option)?

20/09/2016 06:12Top#2

Joined at: 4 months ago

Post: 1

Thank: 0

Thanked: 0

You can use a polyfill for bind, like the MDN's one. There are some differences with the native one, as noted in the link.

if (!Function.prototype.bind) {     Function.prototype.bind = function(oThis) {        if (typeof this !== 'function') {        // closest thing possible to the ECMAScript 5        // internal IsCallable function        throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');     }      var aArgs   = Array.prototype.slice.call(arguments, 1),         fToBind = this,         fNOP    = function() {},         fBound  = function() {             return fToBind.apply(this instanceof fNOP                    ? this                    : oThis,                    aArgs.concat(Array.prototype.slice.call(arguments)));         };      if (this.prototype) {         // Function.prototype doesn't have a prototype property         fNOP.prototype = this.prototype;      }     fBound.prototype = new fNOP();      return fBound; }; 

}

Similar articles

IE9 dosen't support my Button Tag

4 months ago - Reply: 0 - Views: 14

SSRS 2016 Web protal in IE8

4 months ago - Reply: 0 - Views: 13

how to handle @keyframes not supported by ie9?

4 months ago - Reply: 0 - Views: 5

Detect Windows XP in Firefox with JS

4 months ago - Reply: 1 - Views: 47

IE8 Not showing divs with floats

4 months ago - Reply: 2 - Views: 130

Including ECMA 5 script in IE8

5 months ago - Reply: 1 - Views: 98

XDomainRequest does not work in ie8 & ie9

5 months ago - Reply: 0 - Views: 10

How to minify angular.js?

5 months ago - Reply: 1 - Views: 30

VBA and IE8 - scrape text buried in table

5 months ago - Reply: 1 - Views: 37

Detect http satus IE10

5 months ago - Reply: 0 - Views: 6

how to compress angular.js?

5 months ago - Reply: 0 - Views: 3

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re