Paul Krill
Editor at Large

Google’s Polymer zeroes in on ES6 compatibility, interoperability

news
May 18, 20172 mins

Polymer 2.0 promises much improved ECMAScript 6 standards support and interoperability with other libraries and frameworks

puzzle missing piece
Credit: 422737

Polymer, Google’s open source JavaScript library for building reusable HTML elements, has graduated to version 2.0, a major revision that improves the data system, interoperability with other web libraries and frameworks, and support for ECMAScript 6 standards. ECMAScript is the official specification underlying JavaScript and implemented in web browsers.

Arriving nearly two years after Polymer 1.0, the 2.0 release complies with HTML custom elements v1, for creating new HTML tags, and shadow DOM v1, for self-contained web components. Developers can now draw on Polymer APIs associated with both specifications. Polymer 2.0 uses standard ECMAScript 6 classes and custom elements v1 methods rather than a Polymer factory method, according to release notes. Developers can mix Polymer features with standard JavaScript, although the factory method is still supported via a compatibility layer. 

“Polymer 2.0 is based on web platform standards that are natively supported on over 1 billion mobile devices,” Google’s Wendy Ginsberg, product manager for Polymer, said at the recent Google I/O conference in Silicon Valley. The upgrade is one-quarter the size of Polymer 1.0, she said. Web components built with version 2.0 are interoperable by default, meaning they can be used in popular JavaScript frameworks.

Improvements to the data system make it easier to debug the propagation of data across elements. Simpler array handling is featured along with batched data changes, which can improve performance and correctness.

Polymer 2.0 removes the need to use Polymer.dom for DOM manipulation, making it easier to use Polymer components with other web development libraries and frameworks. In addition, shady DOM code has been repackaged into a reusable polyfill, instead of being integrated into Polymer.

For migrating from Polymer 1.0, Polymer 2.0 features a backward compatibility layer that allows elements written with the 1.0 API to target the 2.0 API and native browser features. A hybrid pattern allows developers to port elements to a common subset of features in Polymer 1.0 and Polymer 2.0. Those elements can run in applications targeting either version of the library, according to Google. Note that some minor template changes may also be needed for migration.

Polymer 2.0 also ships with an improved polyfill loader that loads only the necessary polyfills for an individual browser, resulting in a reduction in payload. Google’s goal behind Polymer is to help developers build Progressive Web Apps, which are focused on providing a more native-like application experience, working with multiple form factors and browsers.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author