From eb2385aa633dccd6e47b8aeb4fe6fb02610b2c1f Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 1 Apr 2019 11:59:53 -0700 Subject: [PATCH 1/8] Ensure `className` bindings work correctly when `ShadyDOM.noPatch` is used. Puts `className` on `Polymer.dom` and ensures any sets to `className` in the binding system, go through that wrapper. Note, depends on https://github.com/webcomponents/shadydom/pull/326. --- lib/legacy/polymer.dom.js | 2 +- lib/mixins/property-effects.js | 8 ++++ test/unit/polymer-dom-nopatch.html | 62 ++++++++++++++++++++++++++++++ test/unit/polymer-dom.html | 58 +++++++++++++++++++++++++++- 4 files changed, 128 insertions(+), 2 deletions(-) diff --git a/lib/legacy/polymer.dom.js b/lib/legacy/polymer.dom.js index 6d7f0eb667..e81a6c2519 100644 --- a/lib/legacy/polymer.dom.js +++ b/lib/legacy/polymer.dom.js @@ -441,7 +441,7 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP ]); forwardProperties(DomApiNative.prototype, [ - 'textContent', 'innerHTML' + 'textContent', 'innerHTML', 'className' ]); } diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index c92bea3fa6..cdff1f5b45 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -727,6 +727,10 @@ function setupCompoundStorage(node, binding) { storage[target] = literals; // Configure properties with their literal parts if (binding.literal && binding.kind == 'property') { + // Note, className needs style scoping so this needs wrapping. + if (target === 'className') { + node = wrap(node); + } node[target] = binding.literal; } } @@ -1407,6 +1411,10 @@ export const PropertyEffects = dedupingMixin(superClass => { // implement a whitelist of tag & property values that should never // be reset (e.g. .value &&