+ "description": "The DOM insertion methods append/prepend/before/after fail on elements that have a length property, like a form or text node:\\\n\\\nThe problem lies in $.clean, proposed fix (tested):\\\n{{{\\\n$.clean = function(a) {\\\n\tvar r = [];\\\n\tfor ( var i = 0; i < a.length; i++ )\\\n\t\tif ( a[i].constructor == String ) {\\\n\t\t\tvar div = document.createElement(\\\"div\\\");\\\n\t\t\tdiv.innerHTML = a[i];\\\n\t\t\tfor ( var j = 0; j < div.childNodes.length; j++ )\\\n\t\t\t\tr[r.length] = div.childNodes[j];\\\n\t\t} else if ( a[i].length && !a[i].nodeType ) // added fix for nodes with length property (form, text node)\\\n\t\t\tfor ( var j = 0; j < a[i].length; j++ )\\\n\t\t\t\tr[r.length] = a[i][j];\\\n\t\telse if ( a[i] != null )\\\n\t\t\tr[r.length] =\\\n\t\t\t\ta[i].nodeType ? a[i] : document.createTextNode(a[i].toString());\\\n\treturn r;\\\n};\\\n}}}\\\n\\\nSee http://jquery.com/discuss/2006-May/000804/",
0 commit comments