Why h function make list or enum so weird?

#list[#h(1em,weak: true)$1/2$

test]

#show math.equation.where(block:false): it=>h(1em,weak: true) + it 

#list[$1/2$

test]

A list item has a body-indent that adds space between the list marker and the text of that list item. When the first thing in that list item body is a weak space, that weak space is ignored since there is already a space.

Effect of body-indent:

#let test-body = [$1/2$

test]

Normal `body-indent`
#list[#h(1em,weak: true)#test-body]
Adjusted `body-indent`
#list(body-indent: 5em)[#h(1em,weak: true)#test-body]

My guess as to why your second part does work is that when the list part of the layouting happens, the body of the list item doesn’t yet include the weak space. This is added afterwards when the show rule is applied to the equation.
Here’s your code again but with an added show rule that let’s us hover our mouse over it to see what values end up there.

#show list: it => it

#list[#h(1em,weak: true)$1/2$

test]

#show math.equation.where(block:false): it=>h(1em,weak: true) + it
#list[$1/2$

test]

The important part here are the parts within each children: ( section (highlighted in the blue rectangles). The first list includes a child that starts with a weak space. The second list that gets process has no weak space, just an equation.

A list item has a body-indent that adds space between the list marker and the text of that list item. When the first thing in that list item body is a weak space, that weak space is ignored since there is already a space.

Effect of body-indent:

#let test-body = [$1/2$

test]

Normal `body-indent`
#list[#h(1em,weak: true)#test-body]
Adjusted `body-indent`
#list(body-indent: 5em)[#h(1em,weak: true)#test-body]

My guess as to why your second part does work is that when the list part of the layouting happens, the body of the list item doesn’t yet include the weak space. This is added afterwards when the show rule is applied to the equation.
Here’s your code again but with an added show rule that let’s us hover our mouse over it to see what values end up there.

#show list: it => it

#list[#h(1em,weak: true)$1/2$

test]

#show math.equation.where(block:false): it=>h(1em,weak: true) + it
#list[$1/2$

test]

The important part here are the parts within each children: ( section (highlighted in the blue rectangles). The first list includes a child that starts with a weak space. The second list that gets process has no weak space, just an equation.