QubitProducts / slapdash

A lightweight JavaScript utility belt with native method override protection
http://npmjs.org/packages/slapdash
MIT License
3 stars 1 forks source link

Use browser-native methods where possible; otherwise fallback to slappin' it #8

Closed jimmed closed 8 years ago

jimmed commented 8 years ago

@alanclarke @roberttod @KidkArolis

This solves the problems of:

I had to delete my IE VMs to make room for an OSX update, so I haven't tested these properly yet...

Bundle Size (bytes)

browserify.js:         10175
browserify.min.js:     5045
browserify.min.js.gz:  1608

webpack.js:            11275
webpack.min.js:        3716
webpack.min.js.gz:     1265
roberttod commented 8 years ago

Looks great, can't wait to use it 👍

jimmed commented 8 years ago

Tests are now at least running in IE8, although roughly 1/3 fail.

Definitely know what I'm doing tomorrow!

IE 8.0.0 (Windows XP 0.0.0) bind "before each" hook for "should not use the native bind function" FAILED
    Attempted to wrap undefined property bind as function
IE 8.0.0 (Windows XP 0.0.0) bind "after each" hook for "should not use the native bind function" FAILED
    'spy' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) each should call `callback` once for each element of `array` FAILED
    expected 0 to equal 3
IE 8.0.0 (Windows XP 0.0.0) each should call `callback`, bound to `context` FAILED
    expected spy to always be called with { success: true } as this but was called with
IE 8.0.0 (Windows XP 0.0.0) each should always return `undefined` FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) extend should return the target object FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) extend should override the target object with the source object FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) extend should override from left to right FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) extend should extend missing keys FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) filter callback behaviour should call `callback` once for each element of `array` FAILED
    expected 0 to equal 3
IE 8.0.0 (Windows XP 0.0.0) filter callback behaviour should call `callback`, bound to `context` FAILED
    expected spy to always be called with { success: true } as this but was called with
IE 8.0.0 (Windows XP 0.0.0) filter filtering should not filter out on true FAILED
    expected [] to sort of equal [ 'hello', 'there', 'tests' ]
IE 8.0.0 (Windows XP 0.0.0) filter filtering should filter items matching the predicate FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) find should call `callback` for each element of `array`, until a match is found FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) invoke should invoke methods on object literals FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) invoke should invoke methods on an object's prototype FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) invoke should return an array of the original length FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) invoke should pass additional parameters to the callback FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) keys should return the keys of an object FAILED
    expected [] to sort of equal [ 'z', 'a', 'b', 'c' ]
IE 8.0.0 (Windows XP 0.0.0) keys should return the keys of an array FAILED
    expected [] to sort of equal [ '0', '1', '2', '3' ]
IE 8.0.0 (Windows XP 0.0.0) map "before each" hook for "should call `callback` once for each element of `array`" FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) objectEach "before each" hook for "should call `callback` once for each element of `object`" FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) objectMap should call `callback` once for each element of `object` FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) objectMap asArray should return a new array FAILED
    Object doesn't support this property or method
IE 8.0.0 (Windows XP 0.0.0) objectReduce "before each" hook for "should call `callback` once for each element of `object`" FAILED
    Function expected
IE 8.0.0 (Windows XP 0.0.0) pluck "before each" hook for "should return an array of same length" FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) reduce "before each" hook for "should call `callback` once for each element of `array`" FAILED
    Function expected
IE 8.0.0 (Windows XP 0.0.0) slice with no operands should shallow equal the input FAILED
    expected [] to sort of equal [ 1, 2, 3, 4, 5 ]
IE 8.0.0 (Windows XP 0.0.0) slice with 0 as start operand should shallow equal the input FAILED
    expected [] to sort of equal [ 1, 2, 3, 4, 5 ]
IE 8.0.0 (Windows XP 0.0.0) slice with positive start operand should return the near end of the array FAILED
    expected [] to sort of equal [ 3, 4, 5 ]
IE 8.0.0 (Windows XP 0.0.0) slice with negative start operand should return the far end of the array FAILED
    expected [] to sort of equal [ 4, 5 ]
IE 8.0.0 (Windows XP 0.0.0) without should filter out multiple elements FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) without should also filter out multiple elements FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) without should not filter non-existant elements FAILED
    'undefined' is null or not an object
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
IE 8.0.0 (Windows XP 0.0.0) WARN: 'Could not get Array.prototype.reduce'
jimmed commented 8 years ago

As we've not yet reached 1.0.0, I'm tempted to merge this and tag as v0.2, then open a PR for IE8 support (as 0.3?)