Saturday, August 16, 2014

Don't Mix Browser Events in Paper (Polymer)

But the gods of my chain and Jerry Seinfeld would frown on that, so...

Up today, I worry about event propagation in paper elements. Specifically, when I add a pizza topping to an <x-pizza>, the event should not trigger the pizza toppings card to transition back to its initial “chip” state:

The ingredients are core-item elements whose on-click attribute points to the add() method on the backing class:

Tap events are one the Polymer normalized events, which aid in cross-platform and cross-device development. The tap event work for both mouse and finger, firing when the pointer goes down and up again.