diff options
author | Rick Waldron waldron.rick@gmail.com <waldron.rick@gmail.com> | 2012-03-06 10:22:58 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-03-06 12:54:51 -0500 |
commit | 619f0d908a4227d4fd49971d7f9a5290eaffd72d (patch) | |
tree | 06dffc7d5d44172bb2d119fb8d431a055e522406 /src/manipulation.js | |
parent | e529d91ccd00a75fcfa45a6aebaf8ecf0a9bac4b (diff) | |
download | jquery-619f0d908a4227d4fd49971d7f9a5290eaffd72d.tar.gz jquery-619f0d908a4227d4fd49971d7f9a5290eaffd72d.zip |
Guard against exceptions when clearing safeChildNodes.
Supplements #11356 and fixes unit test failures in FF 3.6.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 159c4c488..0b42810da 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -727,10 +727,14 @@ jQuery.extend({ // to avoid hoarding elements. Fixes #11356 if ( div ) { div.parentNode.removeChild( div ); - remove = safeChildNodes[ safeChildNodes.length - 1 ]; - if ( remove && remove.parentNode ) { - remove.parentNode.removeChild( remove ); + // Guard against -1 index exceptions in FF3.6 + if ( safeChildNodes.length > 0 ) { + remove = safeChildNodes[ safeChildNodes.length - 1 ]; + + if ( remove && remove.parentNode ) { + remove.parentNode.removeChild( remove ); + } } } } |