This is a simplified version of https://www.polymer-project.org/2.0/docs/upgrade. It also lists what warnings and fixes are available for each upgrade task.
<dom-module>usingisornameshould be replaced to useid- Warns
- Fixable: Except
dom-modules that contain bothnameandis
- Move
<style>tags inside the<template>- Warns
- Fixable
- Update your element's DOM template to use the new
<slot>element instead of<content>- Warns
- Fixable: Except advanced usages including stamping templates
- Update any URLs inside the template.
- Future: Potentially warn/fix missing
importPathandrootPath
- Future: Potentially warn/fix missing
- Update styles to use the
::slotted()selector in place of::content- Warns
- Fixable: Except deeper than first descendant
- Future: Potentially warn on selectors after
::slotted()#169
- Remove any
/deep/and::shadowCSS rules- Warns
- Remove :root selectors #168
- Warns
- Fixable
- Update custom property syntax
- Warns
- Fixable
- Wrap
custom-styleelements #166- Warns
- Fixable
Polymer.domreturnsNodeListnow instead ofArray
- Don't use
Polymer.dom - Use
this.shadowRootin place ofPolymer.dom(this.root)- Future: Potentially, convert usage
- For events, use the standard v1 event API
- Warns
- Future: Potentially, fixable
- The
Polymer.FlattenedNodesObserverclass can be used to replace the 1.xobserveNodesmethod - Replace the
getEffectiveChildrenmethod, use thegetFlattenedNodeshelper method, and filter down to just the elements - Replace the
getContentChildrenmethod, write platform code to perform this functionality (get theassignedNodes, and filter down to just the elements)
- The
customStyleinstance property has been removed. UseupdateStylesinstead.
- Lifecycle hooks have changed
- Remove any type extensions
is=""for P2 usages, leave for hybrid
All could potentially have warnings and potential fixes
Polymer.instanceofandPolymer.isInstance: no longer needed, useinstanceofandinstanceof Polymer.Elementinstead.element.getPropertyInfo: This API returned unexpected information some of the time and was rarely used.element.getNativePrototype: Removed because it is no longer needed for internal code and was unused by users.element.beforeRegister: This was originally added for metadata compatibility with ES6 classes. We now prefer users create ES6 classes by extendingPolymer.Element, specifying metadata in the staticpropertiesandobserversproperties.element.attributeFollows: Removed due to disuse.element.classFollows: Removed due to disuse.listenersRemoved ability to useid.eventto add listeners to elements in shadow DOM. Use declarative template event handlers instead.
All could potentially have warnings and potential fixes
async:this.async(someMethod);orPolymer.Async.microTask.run(() => this.someMethod());=>setTimeout(() => this.someMethod(), 500);debounce:this.debounce=>Polymer.Debounce.debouncerfire:this.fire('some-event')=>this.dispatchEvent(new CustomEvent('some-event', { bubbles: true, composed: true }));importHref:this.importHref=>Polymer.importHref$$:$$=>this.shadowRoot.querySelector
There are other changes that should happen that were hard to represent in a concise list. These changes above should cover the majority of the changes to migrate to using P2.