Skip to content

Commit e20ae7b

Browse files
committed
Merge branch 't/11783' into major
2 parents d1b421a + 60b54e1 commit e20ae7b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugins/image2/plugin.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@
290290

291291
parts: {
292292
image: 'img',
293-
caption: 'figcaption',
294-
link: 'a'
293+
caption: 'figcaption'
294+
// parts#link defined in widget#init
295295
},
296296

297297
// The name of this widget's dialog.
@@ -370,6 +370,14 @@
370370
lock: this.ready ? helpers.checkHasNaturalRatio( image ) : true
371371
};
372372

373+
// If we used 'a' in widget#parts definition, it could happen that
374+
// selected element is a child of widget.parts#caption. Since there's no clever
375+
// way to solve it with CSS selectors, it's done like that. (#11783).
376+
this.parts.link = this.element.is( 'a' ) ?
377+
this.element : this.element.getFirst( function( el ) {
378+
return el.is( 'a' );
379+
} );
380+
373381
// Depending on configuration, read style/class from element and
374382
// then remove it. Removed style/class will be set on wrapper in #data listener.
375383
// Note: Center alignment is detected during upcast, so only left/right cases

0 commit comments

Comments
 (0)