Remove ve.isMixedIn(), it's unused and it's evil

Change-Id: I5a5fc4c8eb56530dbac3bc32122faf20b8c92aa5
This commit is contained in:
Trevor Parscal 2013-10-11 16:20:01 +02:00 committed by Krinkle
parent a09473b39a
commit 395d5f563c
2 changed files with 1 additions and 53 deletions

View file

@ -9,37 +9,6 @@ QUnit.module( 've' );
/* Tests */
// ve.createObject: Tested upstream (JavaScript)
// ve.inheritClass: Tested upstream (OOJS)
// ve.mixinClass: Tested upstream (OOJS)
QUnit.test( 'isMixedIn', 11, function ( assert ) {
function Foo () {}
function Bar () {}
function Quux () {}
ve.inheritClass( Quux, Foo );
ve.mixinClass( Quux, Bar );
var b = new Bar(),
q = new Quux();
assert.strictEqual( ve.isMixedIn( Foo, Function ), false, 'Direct native inheritance is not considered' );
assert.strictEqual( ve.isMixedIn( Foo, Object ), false, 'Indirect native inheritance is not considered' );
assert.strictEqual( ve.isMixedIn( Quux, Foo ), false, 've.inheritClass does not affect mixin status' );
assert.strictEqual( ve.isMixedIn( Foo, Foo ), false, 'Foo does not mixin Foo' );
assert.strictEqual( ve.isMixedIn( Bar, Foo ), false, 'Bar does not mixin Foo' );
assert.strictEqual( ve.isMixedIn( Quux, Bar ), true, 'Quux has Bar mixed in' );
assert.strictEqual( ve.isMixedIn( Bar, Quux ), false, 'Bar does not mixin Quux' );
assert.strictEqual( ve.isMixedIn( q, Foo ), false, 've.inheritClass does not affect mixin status' );
assert.strictEqual( ve.isMixedIn( b, Foo ), false, 'b does not mixin Foo' );
assert.strictEqual( ve.isMixedIn( q, Bar ), true, 'q has Bar mixed in' );
assert.strictEqual( ve.isMixedIn( b, Quux ), false, 'b does not mixin Quux' );
} );
// ve.cloneObject: Tested upstream (OOJS)
// ve.getObjectValues: Tested upstream (OOJS)

View file

@ -62,28 +62,7 @@
* @method
* @inheritdoc OO#mixinClass
*/
ve.mixinClass = function ( targetFn, originFn ) {
oo.mixinClass( targetFn, originFn );
// Track mixins
targetFn.mixins = targetFn.mixins || [];
targetFn.mixins.push( originFn );
};
/**
* Check if a constructor or object contains a certain mixin.
*
* @param {Function|Object} a Class or object to check
* @param {Function} mixin Mixin to check for
* @returns {boolean} Class or object uses mixin
*/
ve.isMixedIn = function ( subject, mixin ) {
// Traverse from instances to the constructor
if ( $.type( subject ) !== 'function' ) {
subject = subject.constructor;
}
return !!subject.mixins && subject.mixins.indexOf( mixin ) !== -1;
};
ve.mixinClass = oo.mixinClass;
/**
* @method