mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Wrap obj.constructor test in try/catch. Thanks to bkrausz. Fixes #9897
This commit is contained in:
parent
27291ff06d
commit
ad16db370e
@ -500,12 +500,17 @@ jQuery.extend({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// Not own constructor property must be Object
|
// Not own constructor property must be Object
|
||||||
if ( obj.constructor &&
|
if ( obj.constructor &&
|
||||||
!hasOwn.call(obj, "constructor") &&
|
!hasOwn.call(obj, "constructor") &&
|
||||||
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} catch ( e ) {
|
||||||
|
// IE8,9 Will throw exceptions on certain host objects #9897
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Own properties are enumerated firstly, so to speed up,
|
// Own properties are enumerated firstly, so to speed up,
|
||||||
// if last one is own, then all properties are own.
|
// if last one is own, then all properties are own.
|
||||||
|
@ -290,7 +290,7 @@ test("type", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("isPlainObject", function() {
|
test("isPlainObject", function() {
|
||||||
expect(14);
|
expect(15);
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
@ -331,6 +331,13 @@ test("isPlainObject", function() {
|
|||||||
// Window
|
// Window
|
||||||
ok(!jQuery.isPlainObject(window), "window");
|
ok(!jQuery.isPlainObject(window), "window");
|
||||||
|
|
||||||
|
try {
|
||||||
|
jQuery.isPlainObject( window.location );
|
||||||
|
ok( true, "Does not throw exceptions on host objects");
|
||||||
|
} catch ( e ) {
|
||||||
|
ok( false, "Does not throw exceptions on host objects -- FAIL");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var iframe = document.createElement("iframe");
|
var iframe = document.createElement("iframe");
|
||||||
document.body.appendChild(iframe);
|
document.body.appendChild(iframe);
|
||||||
|
Loading…
Reference in New Issue
Block a user