Skip to content

Commit 7dbc01a

Browse files
committed
Avoid problems when adding text which happens to match an Object method name.
Fixes #6779.
1 parent 6a0942c commit 7dbc01a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/manipulation.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,12 @@ function buildFragment( args, nodes, scripts ) {
399399
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
400400
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
401401
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
402+
args[0] != 'hasOwnProperty' &&
402403
!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
403404

404405
cacheable = true;
405-
cacheresults = jQuery.fragments[ args[0] ];
406+
cacheresults = jQuery.fragments.hasOwnProperty(args[0]) ?
407+
jQuery.fragments[ args[0] ] : null;
406408
if ( cacheresults ) {
407409
if ( cacheresults !== 1 ) {
408410
fragment = cacheresults;
@@ -599,4 +601,4 @@ function evalScript( i, elem ) {
599601
if ( elem.parentNode ) {
600602
elem.parentNode.removeChild( elem );
601603
}
602-
}
604+
}

0 commit comments

Comments
 (0)