It's easy to build a popover using Cocoa. It's hard on the mobile web.
What do I mean by "a popover"?
• An element (View)
• Positioned relative to another element (Button)
• With an arrow pointing at Button
• Where View does not overflow the viewport
• Where the arrow is attached to the appropriate side of the view
• Where the arrow does not jut out past the end of the view
However, just like in my previous post about touch events, getting the fine details right is fairly complicated.
Most importantly, figuring out a presentation of the popover and its arrow that does not violate any of the above constraints is a full-blown constraint-solving problem.
Cocoa solves the problem through the use of scenario-solving approaches. To the web's credit (https://twitter.com/BrendanEich/statuses/219794395803811840
), it does not usually turn to narrowly tailored solutions, favoring general-purpose but rich solutions that solve the same problems.
The best of these solutions, like CSS3's Flexible Box Model, don't just provide ultra-low-level primitives. They give us broadly applicable APIs that dramatically expand what we can express directly.+Alex Russell