@sheppy
thanks sheppy, uhm, that wasn’t what I was confused about, I post this late midnight, so probably what I typed was not matching what was in my mind… So like you said, in this code, submit event handler is registered at that form, thus submit event will be caught by form, only if the submit event ever gets fired. But:
Who fires “submit” event in this code, on what occasion? Is it fired when I click button?
But the doc on “native form widget”(link is on top post) says that, if button elem with no type attr specified then the button is anonymous button by default which does nothing when clicked, and my guess to that “does nothing” at least means it doesn’t trigger submit event. In this code, this button has no type, which is exactly this case.
Then when I searched about “button api” doc(again link on top post) it says default of button’s type attribute is type=submit.
So I tried with example page of
- button type=submit
- button type=button (the anonymous)
- button (with no type)
Then I see both 1 and 3 submit and 2 doesn’t, so it looks like the native form widgets doc wasn’t correct about “default button with no type value is anonymous”. But after all it’s just my guess based on trying on some example pages.