File tree Expand file tree Collapse file tree
packages/core/src/runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1027,8 +1027,7 @@ export function initSandboxRuntimeModular(): void {
10271027 el . style . position = "absolute" ;
10281028 }
10291029 if ( tag !== "audio" ) {
1030- // An <img> measures 0px until its file loads; its size comes from the file, never a 100% fill.
1031- const fillsWhenEmpty = tag !== "img" ;
1030+ const sizedByItsFile = tag === "img" ;
10321031 const forcedWidth = parseDimensionPx ( el . getAttribute ( "data-width" ) ) ;
10331032 const forcedHeight = parseDimensionPx ( el . getAttribute ( "data-height" ) ) ;
10341033 const hasMeaningfulComputedWidth = computed . width !== "0px" && computed . width !== "auto" ;
@@ -1037,14 +1036,14 @@ export function initSandboxRuntimeModular(): void {
10371036 if ( ! el . style . width && ! hasMeaningfulComputedWidth ) {
10381037 el . style . width = forcedWidth ;
10391038 }
1040- } else if ( fillsWhenEmpty && ! el . style . width && computed . width === "0px" ) {
1039+ } else if ( ! sizedByItsFile && ! el . style . width && computed . width === "0px" ) {
10411040 el . style . width = "100%" ;
10421041 }
10431042 if ( forcedHeight ) {
10441043 if ( ! el . style . height && ! hasMeaningfulComputedHeight ) {
10451044 el . style . height = forcedHeight ;
10461045 }
1047- } else if ( fillsWhenEmpty && ! el . style . height && computed . height === "0px" ) {
1046+ } else if ( ! sizedByItsFile && ! el . style . height && computed . height === "0px" ) {
10481047 el . style . height = "100%" ;
10491048 }
10501049 }
You can’t perform that action at this time.
0 commit comments