Uses `shadowRoot.adoptedStyleSheets` for element styling when supported (currently Chrome) and only if a css build is used. The build restriction is in place in order to support `@apply` via ShadyCSS. Currently ShadyCSS works only with a style element in the element template.
Applies micro-optimizations that were found to improve element creation benchmarks by 5-10%, and removes obsolete settings:
* Removed `legacyNoBatch` and `legacyNotifyOrder` settings.
* dom-if/repeat: `dom-change` and `renderedCount` no longer fire with `legacyOptimizations` set.
* legacy-element-mixin: `isAttached` now set before calling `connectedCallback` so it is batched with initial rendering.
* `PropertiesChanged`: property accessor code now inlined for efficiency rather than calling `_get/_setProperty`. The `__dataCounter` tracking flag has been moved here to avoid the need to override `_flushProperties` in `PropertyEffects`.
* `PropertyEffects`: inlined `runEffectsForProperty` into `runEffects` for efficiency. Removed wrapping around sending data events.
* `async`: In the microtask scheduler, now only provoke a DOM mutation if needed.
* Use sudo to fix chrome testing
There is a bug with the chrome sandbox in the Travis CI container
system, which is fixed by using `sudo: required`.
Related to travis-ci/travis-ci#8836
* reduce cognitive overhead of the test runner
* remove testing polyfilled Custom Elements with native ShadowDOM
* Use headless chrome and firefox
Use MacOS 10.13 for Safari 11
* disable testing CSS Custom Property Shim
* move sauce tests into script for travis_wait compat
Fixes#4909. Elements using this mixin will not "enable" themselves when they have a `disable-upgrade` attribute. This mirrors a feature of Polymer 1.x but is now opt-in.
Previously Polymer collapsed any included shared styles into 1 style element. This prevents the browser from recognizing shared style elements as similar and optimizing them. With this change, we no longer collapse styles. Note, included styles are still currently collapsed by ShadyCSS but the polyfill will likely not do this in the future.
dom-repeat and/or dom-if booting before custom-style is registered
can break the complicated loading strategy of ShadyCSS.
By only calling ShadyCSS for elements with templates, we both fix this
issue and improve performance for template-less element booting
Fixes#4521