mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-30 18:34:40 +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 ) {
|
function handleDOMEventIfEligible( handler ) {
|
||||||
return function ( event ) {
|
return function ( event ) {
|
||||||
// if the element is a text node, as events can be triggered on text nodes
|
let target = event && event.target;
|
||||||
// it won't have a closest method, so we get its parent element (T340081)
|
if ( !target ) {
|
||||||
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 ) {
|
|
||||||
return;
|
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 ) {
|
if ( target === null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,8 @@ module.exports = ( env, argv ) => ( {
|
||||||
// Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers
|
// 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
|
// 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.
|
// well understood. Related to bundlesize minified, gzipped compressed file size tests.
|
||||||
maxAssetSize: 46.4 * 1024,
|
maxAssetSize: 46.5 * 1024,
|
||||||
maxEntrypointSize: 46.4 * 1024,
|
maxEntrypointSize: 46.5 * 1024,
|
||||||
|
|
||||||
// The default filter excludes map files but we rename ours.
|
// The default filter excludes map files but we rename ours.
|
||||||
assetFilter: ( filename ) => !filename.endsWith( srcMapExt )
|
assetFilter: ( filename ) => !filename.endsWith( srcMapExt )
|
||||||
|
|
Loading…
Reference in a new issue