简体   繁体   中英

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

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:

形象

形象

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM