Converted from platform.js TO webcomponents.js