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 62528f6d5d443f8c572cf326a488f532b7b997c1
Showing with 9 additions and 0 deletions.
  1. +5 −0 src/core.js
  2. +4 −0 test/unit/core.js
@@ -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.
You can’t perform that action at this time.