mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
Fix for ve.ce.BranchNode.setupSlugs - insert each slug only once
When using jQuery insertBefore and insertAfter make sure to pass as a parameter jQuery selection of only one element (first for insertBefore and last for insertAfter). Change-Id: Id469ed775642ab5be8e274ab3cb7730899e9487a
This commit is contained in:
parent
411b31cc93
commit
27ddb456c8
|
@ -208,7 +208,7 @@ ve.ce.BranchNode.prototype.setupSlugs = function () {
|
|||
for ( i = 0; i < this.children.length; i++ ) {
|
||||
// First sluggable child (left side)
|
||||
if ( i === 0 && this.children[i].canHaveSlugBefore() ) {
|
||||
this.slugs[i] = $slug.clone().insertBefore( this.children[i].$ );
|
||||
this.slugs[i] = $slug.clone().insertBefore( this.children[i].$.first() );
|
||||
}
|
||||
if ( this.children[i].canHaveSlugAfter() ) {
|
||||
if (
|
||||
|
@ -217,7 +217,7 @@ ve.ce.BranchNode.prototype.setupSlugs = function () {
|
|||
// Sluggable child followed by another sluggable child (in between)
|
||||
( this.children[i + 1] && this.children[i + 1].canHaveSlugBefore() )
|
||||
) {
|
||||
this.slugs[i + 1] = $slug.clone().insertAfter( this.children[i].$ );
|
||||
this.slugs[i + 1] = $slug.clone().insertAfter( this.children[i].$.last() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue