Skip to content
Permalink
Browse files
#7780 $.isPlainObject is inconsistent with 'special objects'
  • Loading branch information
rwaldron committed Dec 15, 2010
1 parent 2defa48 commit 62528f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
@@ -522,6 +522,11 @@ jQuery.extend({
return false;
}

// Fixed #7780, Firefox and IE evaluate location incorrectly
if ( !("constructor" in obj) || /Location/.test(obj.constructor.toString() ) ) {
return false;
}

// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.

@@ -288,6 +288,10 @@ test("isPlainObject", function() {
// Window
ok(!jQuery.isPlainObject(window), "window");

// Special Host Objects
ok(!jQuery.isPlainObject(document.location), "!document.location");
ok(!jQuery.isPlainObject(window.location), "!window.location");

try {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);

0 comments on commit 62528f6

Please sign in to comment.