My understanding of this is that dom-if not a stamp until the expression becomes believable, but after that it behaves just like [hidden] . Thus, dom-if is a pessimistic [hidden] that delays embossing for as long as possible.
This lazy loading approach is favorable in certain situations when embossing a template will be very resource intensive. For example, if the template was very large with several custom components that need to be initialized. If you just used the hidden attribute, you would pay for the cost of creating all of this DOM so that it is not visible until the end.
For simple cases, such as hiding or displaying some text, a div or two, etc., the hidden attribute may be faster, because the cost of creating these elements and hiding them may be less than creating a <template> instance to store your When Polymer sets up the listeners to control the expression for truthfulness, then when it becomes true, all the overhead for stamping the template, parsing it for binding expressions, etc. This is especially true for browsers where <template> support is polyphored.
Thinking about it (and, ideally, testing it) is the best way. Often the differences may be minor, but they are especially careful if this part of your code is in dom-repeat with lots of items or something that often happens. The difference may add up.
source share