Search code examples
polymerpolymer-1.0

What are difference between hostAttributes and properties in polymer?


I'm doing migration from 0.5 to 1.0.

While reading, I notice 2 different way on declaring attributes, using hostAttributes and properties.

What are difference between those 2 ?


Solution

  • Host attributes are attributes that do not match to an element's corresponding Javascript property (which you declare in properties). This includes attributes like class, tabindex, data-* attributes, aria-roles, etc. To declare them during create-time, you must set them in the hostAttributes object. If you are going to bind values into them, you must use $= (which calls Element.setAttribute) rather than =.

    Sources: