Uncaught TypeError: Cannot read property 'trim' of undefined after using Polymer vulcanize

6.9k Views Asked by At

My application based on Polymer-PSK+ and ES2015. Using my distributed version of the application I'll receive the following error: Uncaught TypeError: Cannot read property 'trim' of undefined (elements.js line 5832)

The reason for this is due to 'missing' properties of Polymer paper-input-container-underline element, see:

image

image

The assignment to properties[m[1]] fails due to (m[2] || m[3]).trim();: m[2] = "" and m[3] = undefined

Any hints how to solve this problem and how to use the distributed version of my application?

1

There are 1 best solutions below

2
Sahar Zehavi On

On javascript, both empty strings ("") and the undefined value considered falsy values.

so when you write ("" || undefined), the returned value will be the last falsy value, on this case, undefined, and you cannot perform method calls on an undefined value.

you can read about it here.