Skip to content

Commit

Permalink
Fixed: widget.parts#link element detected inside widget.parts#caption.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Apr 9, 2014
1 parent d1b421a commit 60b54e1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions plugins/image2/plugin.js
Expand Up @@ -290,8 +290,8 @@

parts: {
image: 'img',
caption: 'figcaption',
link: 'a'
caption: 'figcaption'
// parts#link defined in widget#init
},

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

// If we used 'a' in widget#parts definition, it could happen that
// selected element is a child of widget.parts#caption. Since there's no clever
// way to solve it with CSS selectors, it's done like that. (#11783).
this.parts.link = this.element.is( 'a' ) ?
this.element : this.element.getFirst( function( el ) {
return el.is( 'a' );
} );

// Depending on configuration, read style/class from element and
// then remove it. Removed style/class will be set on wrapper in #data listener.
// Note: Center alignment is detected during upcast, so only left/right cases
Expand Down

0 comments on commit 60b54e1

Please sign in to comment.