1 | | Ugh. Major fail. Can someone with privileges fix the code formatting? Sorry :( |
| 1 | Ticket should read: |
| 2 | |
| 3 | I know it's probably just an internal function, but I noticed this is how jQuery detects if an object is a window or not: |
| 4 | {{{ |
| 5 | isWindow: function( obj ) { |
| 6 | return obj && typeof obj === "object" && "setInterval" in obj; |
| 7 | } |
| 8 | }}} |
| 9 | But, that is easily broken by |
| 10 | {{{ |
| 11 | var x = {"setInterval" : "foo" }; |
| 12 | }}} |
| 13 | Wouldn't a better test be: |
| 14 | {{{ |
| 15 | isWindow: function( obj ) { |
| 16 | return obj && typeof obj === "object" && obj.window === window; |
| 17 | } |
| 18 | }}} |
| 19 | |
| 20 | since the window object contains itself infinite times (ie, window.window===window.window.window), whereas (if I'm not mistaken) a regular object wouldn't be able to met that condition. |