1
0
Fork 0

Various ES3-related bugfixes for bugs introduced by v0.2.3

GNU ease.js remains committed to supporting environments as far back as ES3;
unfortunately, this is important due to the popularity of older IE versions
(IE<=8). Btw, ease.js runs on IE 5.5, in case you still need that. ;)

But please don't use a proprietary web browser. Indeed, this is why the
breaks were introduced in the first place: I neglected to run the
browser-based test suite on the proprietary Microsloth browsers until after
the v0.2.3 release, because I do not own a copy of Windows; I had to run it
at work. But, regardless---my apologies; I'll be more diligent.
textend 0.2.4
Mike Gerwitz 2014-08-07 22:57:14 -04:00
commit ee85b058df
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
4 changed files with 26 additions and 11 deletions

View File

@ -59,7 +59,11 @@ exports.standard = {
return retval;
};
retf.super = super_method;
// `super` is reserved and, in ES3, this causes problems with the
// dot-notation; while `foo.super` will work fine in modern (ES5)
// browsers, we need to maintain our ES3 compatibility
retf['super'] = super_method;
return retf;
},

View File

@ -176,6 +176,9 @@ Trait.extend = function( dfn )
return ''+name;
};
// we're not a param trait, but we want consistent data
Trait.___$$mixinargs = [];
// invoked to trigger mixin
Trait.__mixin = function( dfn, tc, base )
{

View File

@ -45,9 +45,11 @@ function Global()
return new Global();
}
// allows us to extend the global object without actually polluting the
// global scope
this._global = new _G();
// do not pollute the global scope (previously, _the_global was used as
// the prototype for a new object to take advantage of native overrides,
// but unfortunately IE<=8 did not support this and always returned
// undefined values from the prototype).
this._alt = {};
}
@ -56,8 +58,9 @@ function Global()
* versions, for any root variable name, and works with ES5 strict mode.
*
* As an example, Node.js exposes the variable `root` to represent global
* scope, but browsers expose `window`. Further, ES5 strict mode will provde
* an error when checking whether `typeof SomeGlobalVar === 'undefined'`.
* scope, but browsers expose `window`. Further, ES5 strict mode will
* provide an error when checking whether `typeof SomeGlobalVar ===
* 'undefined'`.
*
* @return {Object} global object
*/
@ -86,12 +89,14 @@ Global.prototype = {
*/
provideAlt: function( name, f )
{
if ( typeof this._global[ name ] !== 'undefined' )
if ( ( _the_global[ name ] !== undefined )
|| ( this._alt[ name ] !== undefined )
)
{
return;
}
this._global[ name ] = f();
this._alt[ name ] = f();
return this;
},
@ -112,7 +117,9 @@ Global.prototype = {
*/
get: function( name )
{
return this._global[ name ];
return ( this._alt[ name ] !== undefined )
? this._alt[ name ]
: _the_global[ name ];
},
};

View File

@ -229,8 +229,9 @@ require( 'common' ).testCase(
;
// we should be able to invoke the super method by override.super,
// which is added atop of the wrapper
this.assertStrictEqual( override.super(), expected );
// which is added atop of the wrapper (note that we quote it to avoid
// problems with ES3 engines)
this.assertStrictEqual( override['super'](), expected );
},