mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 17:40:12 +00:00
Merge "Use jQuery fake events for sticky header edit buttons"
This commit is contained in:
commit
685d261647
|
@ -290,12 +290,12 @@ function prepareEditIcons(
|
||||||
const $ve = $( primaryEdit );
|
const $ve = $( primaryEdit );
|
||||||
if ( target && $ve.length ) {
|
if ( target && $ve.length ) {
|
||||||
const link = /** @type {HTMLAnchorElement} */( $ve[ 0 ] );
|
const link = /** @type {HTMLAnchorElement} */( $ve[ 0 ] );
|
||||||
const event = new Event( 'click' );
|
const event = $.Event( 'click' );
|
||||||
suffixStickyHref( link );
|
suffixStickyHref( link );
|
||||||
link.dispatchEvent( event );
|
$ve.trigger( event );
|
||||||
unsuffixStickyHref( link );
|
unsuffixStickyHref( link );
|
||||||
// The link has been progressively enhanced.
|
// The link has been progressively enhanced.
|
||||||
if ( event.defaultPrevented ) {
|
if ( event.isDefaultPrevented() ) {
|
||||||
disableStickyHeader();
|
disableStickyHeader();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
@ -310,12 +310,12 @@ function prepareEditIcons(
|
||||||
const $edit = $( secondaryEdit );
|
const $edit = $( secondaryEdit );
|
||||||
if ( $edit.length ) {
|
if ( $edit.length ) {
|
||||||
const link = /** @type {HTMLAnchorElement} */( $edit[ 0 ] );
|
const link = /** @type {HTMLAnchorElement} */( $edit[ 0 ] );
|
||||||
const event = new Event( 'click' );
|
const event = $.Event( 'click' );
|
||||||
suffixStickyHref( link );
|
suffixStickyHref( link );
|
||||||
link.dispatchEvent( event );
|
$edit.trigger( event );
|
||||||
unsuffixStickyHref( link );
|
unsuffixStickyHref( link );
|
||||||
// The link has been progressively enhanced.
|
// The link has been progressively enhanced.
|
||||||
if ( event.defaultPrevented ) {
|
if ( event.isDefaultPrevented() ) {
|
||||||
disableStickyHeader();
|
disableStickyHeader();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue