DesktopArticleTarget: Prevent infinite while loop if $content is empty

Change-Id: I629b2c3f1a4af3441764db7d1d0a7cec96181396
This commit is contained in:
Ed Sanders 2017-01-11 10:10:03 -08:00 committed by Jforrester
parent 09829ae7b4
commit 889ffc0efc

View file

@ -1258,7 +1258,7 @@ ve.init.mw.DesktopArticleTarget.prototype.transformPage = function () {
// Mark every non-direct ancestor between editableContent and the container as uneditable
$content = this.$editableContent;
while ( $content && !$content.parent().is( this.$container ) ) {
while ( $content && $content.length && !$content.parent().is( this.$container ) ) {
$content.prevAll().addClass( 've-init-mw-desktopArticleTarget-uneditableContent' );
$content.nextAll().addClass( 've-init-mw-desktopArticleTarget-uneditableContent' );
$content = $content.parent();