Bug Tracker

Ticket #1807: jQuery.patch.txt

File jQuery.patch.txt, 1.1 KB (added by gyphie, 12 years ago)

Unified diff for patching the bug.

Line 
1--- C:/mydocs/projects/javascript libraries/jquery/jquery-1.2.1.js      Fri Oct 12 14:48:30 2007
2+++ C:/mydocs/projects/javascript libraries/jquery/jquery-1.2.1.jwr1.js Fri Oct 12 16:20:18 2007
3@@ -15,6 +15,9 @@
4        var _jQuery = jQuery;
5 
6 var jQuery = window.jQuery = function(selector, context) {
7+    if (!arguments.length) selector = document; // Make sure $() returns [ document ]
8+    context = context || document;  // If no context is specified then default to document
9+
10        // If the context is a namespace object, return a new object
11        return this instanceof jQuery ?
12                this.init(selector, context) :
13@@ -32,11 +35,12 @@
14 
15 jQuery.fn = jQuery.prototype = {
16        init: function(selector, context) {
17-               // Make sure that a selection was provided
18-               selector = selector || document;
19-
20+        // Undefined selectors should return an empty set
21+               if ( typeof selector === "undefined" ) {
22+                   selector = [];
23+               }
24                // Handle HTML strings
25-               if ( typeof selector  == "string" ) {
26+               else if ( typeof selector  == "string" ) {
27                        var m = quickExpr.exec(selector);
28                        if ( m && (m[1] || !context) ) {
29                                // HANDLE: $(html) -> $(array)