Merge "Add additional debugging closest bug"

This commit is contained in:
jenkins-bot 2023-07-18 14:47:10 +00:00 committed by Gerrit Code Review
commit 6b153fcc44
4 changed files with 24 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View file

@ -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;
}

View file

@ -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 )