From 4fd7cc93b7aef42fa54ab47b5f9b8b9c2a378bd1 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Tue, 30 Jan 2024 08:33:51 -0800 Subject: [PATCH] Do not search for elements if no previews have been registered The findNearestEligibleTarget method is now being called with an empty array and thus an empty string as a selector Follow up to I5f293a134521f086c9f62babb9d06cd9c51d7d47 Bug: T355933 Bug: T356186 Bug: T356193 Change-Id: I3af44ae65d5097fc44744838a4edb07552568b17 (cherry picked from commit 51059828bfb6e1e084ad8613bea7e15837aa64dd) --- resources/dist/index.js | Bin 40797 -> 40837 bytes resources/dist/index.js.map.json | Bin 201289 -> 201398 bytes src/preview/model.js | 7 +++++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/dist/index.js b/resources/dist/index.js index 4ad92f064acb13f412b0a19a678edc77a99a6775..f4fb8178ba48eaaa904c3fd92698488ca2b5cfd6 100644 GIT binary patch delta 150 zcmcb+kEwM((}uY%DVb>+d8Iiying{IdA4b#dC4W2`FR?tn$!Q?>(xNzwO-+c#qRls3 mQklhz)YMWn@^p%HfC_6KGF@ J|LN!y0{~IvCgK19 diff --git a/resources/dist/index.js.map.json b/resources/dist/index.js.map.json index 734dd7725d34640dbdf0fa03eec35dec3db211a6..64873424741ab01dbe1da83a5ae7f151fd8e4c7e 100644 GIT binary patch delta 4130 zcmZu!U2Ggz71jndB+xkNPtrQgKc!Bxlg{k_E-h*Ay)&Mj9k18p^=9i7+HUOi{{PwQ z{ZoWrplS2dHoYZI(=J^DWR z1>AKQOIOHFzKrHsu0E}~K-AJqR0WD={B+Ta7r+L~hUP#_j5sKGPB0PxEn-#^En)C{ zcn)(A2nk(n^45p~N%*H(D-BwBO)N%XL+Jk*m&vuh{OkXM)PixXS!9!4)d zW;ITNTlQR&?%J)B6p28ESrZ*z=557VIjQ9tE0C?M&~oT-SFu**KVCfG8_3OPzVWqi zQEPBW6dx%b=@<1$48a10%nQhcGe`VJ0lm~!x&j4Ez?6#IWzMWhB2rl{AwM{C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FGnax0hd29sqMW2|M1OWOR2Xo@c888p5NaKHwoGK(^Q2X(3#u=x6I2WeHBVZ1 zFat|Wb4G1=!hj8@En=*&>`V=0i9@{s+P?hy6I*dkl8Q_se5i7M25m|9sbZ>ibHF6A zygmzCt(6d&3@CB}W)j2z2n*NPh?(T+7Z%Y+q5J!PDJwuFLfUoB?g6F`wWCmrHxByC zOf0)1K3-D+YCBa(mATE^UDV%u zM{3hv(m~Xc>-r~eng=?J${g*=hxC8moLTY{hpV{=P=M0yhB0ChEexb}8S}(78QqbG zID=G7)~RVV-XCiUzZ z&cTN)dl@EH6EL{S{i&+ZAeI9-0qa)$o>|MY*sNAOkOhjw3xw2^u)zb=QO^hUi*FxA z%KZ54Z{bVkPj8)CfkPd2#w6*=^c2xO4Ml<)p;`=>9xb8cS)ZsSRUpq5YHF_!(9;<=hT z3AfH|Y-VG|=z&{`Ne*e2Of1%zM$#S+EO-Sx9YSA2Su8is6WcrE{GF4j0U=a==<83U zyL$88XSW73#2m%(A~yqGvychS5cRB7xlB{709~)ndW7R;Y#qG$`bVYs*eInfb3;if?2M@N0fE`GY{`|#7vds44_IJ^Jem9PF6?k%r{ diff --git a/src/preview/model.js b/src/preview/model.js index 88972a8e2..f5e2937dd 100644 --- a/src/preview/model.js +++ b/src/preview/model.js @@ -123,8 +123,11 @@ const elementMatchesSelector = ( element, selector ) => { * @return {HTMLElement|null} */ export function findNearestEligibleTarget( element ) { - const selector = selectors.join( ', ' ); - return element.closest( selector ); + if ( selectors.length ) { + const selector = selectors.join( ', ' ); + return element.closest( selector ); + } + return null; } /**