Side navigation
#1763 closed bug (fixed)
Opened October 01, 2007 07:29PM UTC
Closed December 04, 2007 07:37PM UTC
Last modified October 14, 2008 10:36AM UTC
In jQuery clean function, "doc" is sometimes not the proper scope
Reported by: | nettles | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | doc, createElement | Cc: | |
Blocked by: | Blocking: |
Description
When an object that is not the document is passed into the clean function as the second argument, line 783 fails because createElement is not a valid method on that object.
For me, this occurred while using the jqGrid plugin, which has the call stack listed at the bottom of this post. The line in question looks like:
var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement, tb = [];
Changing it to the following works:
var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement ? doc.createElement("div") : document.createElement("div"), tb = [];
Below is the stack trace of the entire issue:
doc.createElement is not a function (no name)(0, "<tr id="1"><td>Row 1 - Value 1</td>")jquery-1.2.1.js (line 783) each(["<tr id="1"><td>Row 1 - Value 1</td>"], function(), undefined)jquery-1.2.1.js (line 585) clean(["<tr id="1"><td>Row 1 - Value 1</td>"], div)jquery-1.2.1.js (line 769) init("<tr id="1"><td>Row 1 - Value 1</td>", div)jquery-1.2.1.js (line 44) jQuery("<tr id="1"><td>Row 1 - Value 1</td>", div)jquery-1.2.1.js (line 20) jQuery("<tr id="1"><td>Row 1 - Value 1</td>", div)jquery-1.2.1.js (line 21) addJSONData(Object total=6 page=1 records=10 rows=[10], div)jquery.jqGrid.js (line 192) (no name)(Object total=6 page=1 records=10 rows=[10])jquery.jqGrid.js (line 216) success()jquery-1.2.1.js (line 2402) onreadystatechange(39)jquery-1.2.1.js (line 2354) [Break on this error] var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb =...
Attachments (0)
Change History (1)
Changed December 04, 2007 07:37PM UTC by comment:1
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed in [4014].