我在如何使用j Query s event.stoppropagation(
)方面有两种做法:
- Optimistic approach - By default, all event handlers are without
stopPropagation()
.stopPropagation()
would be added to a handler only if there s some unnecessary and undesired behaviour caused by event bubbling. - Pessimistic approach - By default,
stopPropagation()
is added to all event handlers. If there s some desired behaviour missing due to disconnected even bubbling, then the correspondingstopPropagation()
would get removed.
我很想知道,在我的发展中使用<条码>推广(<>条码>)时,这两者之间究竟是哪一个,还是哪一个。 我对2点感动更多,因为它认为,由于无谓的泡沫被阻止,它会取得更好的业绩。 我愿听取关于这个问题的专家的意见。