X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=e273cf08a3b790172e1a9659d0c0cc67e2cc72c9;hb=8099cdce800d45109b961e3521fc0080e9a876c6;hp=ba57a6f91a0bc31500dbedb2d4c48773e4dd44c4;hpb=445fdf720ce26b99aadace85b7ec976f90583c3a;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index ba57a6f..e273cf0 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1,5 +1,8 @@ module("manipulation"); +// Ensure that an extended Array prototype doesn't break jQuery +Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be called"); }; + var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; @@ -1244,3 +1247,20 @@ test("jQuery.cleanData", function() { return div; } }); + +test("jQuery.buildFragment - no plain-text caching (Bug #6779)", function() { + expect(1); + + // DOM manipulation fails if added text matches an Object method + var $f = jQuery( "
" ).appendTo( "#main" ), + bad = [ "start-", "toString", "hasOwnProperty", "append", "here&there!", "-end" ]; + + for ( var i=0; i < bad.length; i++ ) { + try { + $f.append( bad[i] ); + } + catch(e) {} + } + equals($f.text(), bad.join(''), "Cached strings that match Object properties"); + $f.remove(); +});