event.target in on events binding: what’s the difference?
A colleague of mine asked me yesterday: what’s the difference between good code and bad ones? I gave my answer without a blink: “Reusability.” The answer struck me. I didn’t realise that before I said it out loud.
One good way to improve reusability, is to consciously refine one’s code with an eye for patterns. Repetitions are worth summing up–it’s just pure fun.
In IE9, if two parent elements don’t have z-index set, their children who do have z-index could jump out of the flow of z-index.
In the flow of all DOM elements, there is something that decides the order of appearance among each other: the stacking context. And its behaviour is somewhat odd in some cases.
After some research, the list of answers I got:
Button overlay on top of Video [iPad]:
- if the default controls of video tag is set to true, there’s no way to override the click events
- libraries like MediaElement disabled the default controls, thereby recapturing events
I came across Paul’s take on this quite a while ago. I simply wish more people could have read this:
When I was five I thought electricity was created by electric sockets. I didn’t realize there were power plants out there generating it. Likewise, it doesn’t occur to most kids that wealth is something that has to be generated. It seems to be something that flows from parents.
Because of the circumstances in which they encounter it, children tend to misunderstand wealth. They confuse it with money. They think that there is a fixed amount of it. And they think of it as something that’s distributed by authorities (and so should be distributed equally), rather than something that has to be created (and might be created unequally).
This is how to achieve “JumpToDefinition” in Vim, for JS and Less files.