mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Merge "Add additional debugging closest bug"
This commit is contained in:
commit
6b153fcc44
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
31
src/index.js
31
src/index.js
|
@ -135,17 +135,30 @@ function registerChangeListeners(
|
|||
*/
|
||||
function handleDOMEventIfEligible( handler ) {
|
||||
return function ( event ) {
|
||||
// if the element is a text node, as events can be triggered on text nodes
|
||||
// it won't have a closest method, so we get its parent element (T340081)
|
||||
if ( event.target.nodeType === 3 ) {
|
||||
event.target = event.target.parentNode;
|
||||
}
|
||||
// If the event bubbles up all the way,
|
||||
// document does not have closest method, so exit early (T336650).
|
||||
if ( event.target === document ) {
|
||||
let target = event && event.target;
|
||||
if ( !target ) {
|
||||
return;
|
||||
}
|
||||
const target = findNearestEligibleTarget( event.target );
|
||||
// if the element is a text node, as events can be triggered on text nodes
|
||||
// it won't have a closest method, so we get its parent element (T340081)
|
||||
if ( target.nodeType === 3 ) {
|
||||
target = target.parentNode;
|
||||
}
|
||||
|
||||
// If the closest method is not defined, let's return early and
|
||||
// understand this better by logging an error. (T340081)
|
||||
if ( target && !target.closest ) {
|
||||
const err = new Error( `T340081: Unexpected DOM element ${target.tagName} with nodeType ${target.nodeType}` );
|
||||
mw.errorLogger.logError( err, 'error.web-team' );
|
||||
return;
|
||||
}
|
||||
|
||||
// If the event bubbles up all the way,
|
||||
// document does not have closest method, so exit early (T336650).
|
||||
if ( target === document ) {
|
||||
return;
|
||||
}
|
||||
target = findNearestEligibleTarget( target );
|
||||
if ( target === null ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ module.exports = ( env, argv ) => ( {
|
|||
// Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers
|
||||
// up-to-date and rounded to the nearest 10th of a kibibyte so that code sizing costs are
|
||||
// well understood. Related to bundlesize minified, gzipped compressed file size tests.
|
||||
maxAssetSize: 46.4 * 1024,
|
||||
maxEntrypointSize: 46.4 * 1024,
|
||||
maxAssetSize: 46.5 * 1024,
|
||||
maxEntrypointSize: 46.5 * 1024,
|
||||
|
||||
// The default filter excludes map files but we rename ours.
|
||||
assetFilter: ( filename ) => !filename.endsWith( srcMapExt )
|
||||
|
|
Loading…
Reference in a new issue