Further fix to ensure Object#is(String|Number) do not throw exceptions on host objects in IE. [#510 state:resolved]
This commit is contained in:
parent
9f5c40c744
commit
31d1c6fd48
|
@ -1,3 +1,5 @@
|
|||
* Further fix to ensure Object#is(String|Number) do not throw exceptions on host objects in IE. (grepmaster, kangax, Tobie Langel, Andrew Dupont)
|
||||
|
||||
* Ensure Enumerable#grep can handle strings with RegExp metacharacters. (Marton Kiss-Albert, kangax)
|
||||
|
||||
* Switch to the "doScroll approach" for the dom:loaded custom event. (javier, Diego Perini, Nick Stakenburg, Andrew Dupont)
|
||||
|
|
|
@ -83,11 +83,19 @@
|
|||
}
|
||||
|
||||
function isString(object) {
|
||||
return typeof (object && object.valueOf()) === "string";
|
||||
try {
|
||||
return typeof (object && object.valueOf()) === "string";
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isNumber(object) {
|
||||
return typeof (object && object.valueOf()) === "number";
|
||||
try {
|
||||
return typeof (object && object.valueOf()) === "number";
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isUndefined(object) {
|
||||
|
|
|
@ -135,6 +135,7 @@ new Test.Unit.Runner({
|
|||
this.assert(!Object.isString({}));
|
||||
this.assert(!Object.isString(false));
|
||||
this.assert(!Object.isString(undefined));
|
||||
this.assert(!Object.isString(document), 'host objects should return false rather than throw exceptions');
|
||||
},
|
||||
|
||||
testObjectIsNumber: function() {
|
||||
|
@ -149,6 +150,7 @@ new Test.Unit.Runner({
|
|||
this.assert(!Object.isNumber({}));
|
||||
this.assert(!Object.isNumber(false));
|
||||
this.assert(!Object.isNumber(undefined));
|
||||
this.assert(!Object.isNumber(document), 'host objects should return false rather than throw exceptions');
|
||||
},
|
||||
|
||||
testObjectIsUndefined: function() {
|
||||
|
|
Loading…
Reference in New Issue