Commit 5927a1a0 5927a1a0fea56f36e77dad3853b07db362ff5ef6 by Nicolas Perriault

Merge pull request #733 from laurentj/issue-732

Fixed betterInstanceOf for Gecko
2 parents 6ad2eead 0e5d3ab7
...@@ -81,19 +81,23 @@ exports.betterTypeOf = betterTypeOf; ...@@ -81,19 +81,23 @@ exports.betterTypeOf = betterTypeOf;
81 function betterInstanceOf(input, constructor) { 81 function betterInstanceOf(input, constructor) {
82 "use strict"; 82 "use strict";
83 /*jshint eqnull:true, eqeqeq:false */ 83 /*jshint eqnull:true, eqeqeq:false */
84 while (input != null) { 84 if (typeof input == 'undefined' || input == null) {
85 if (input == constructor.prototype) { 85 return false;
86 }
87 var inputToTest = input;
88 while (inputToTest != null) {
89 if (inputToTest == constructor.prototype) {
86 return true; 90 return true;
87 } 91 }
88 if (typeof input == 'xml') { 92 if (typeof inputToTest == 'xml') {
89 return constructor.prototype == document.prototype; 93 return constructor.prototype == document.prototype;
90 } 94 }
91 if (typeof input == 'undefined') { 95 if (typeof inputToTest == 'undefined') {
92 return false; 96 return false;
93 } 97 }
94 input = input.__proto__; 98 inputToTest = inputToTest.__proto__;
95 } 99 }
96 return false; 100 return equals(input.constructor.name, constructor.name);
97 } 101 }
98 exports.betterInstanceOf = betterInstanceOf; 102 exports.betterInstanceOf = betterInstanceOf;
99 103
......