From 41bcb1ce0fa0365073d515b3d96f2668c62d4153 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 1 Apr 2019 11:59:53 -0700 Subject: [PATCH 1/2] 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 65a2e31f80..8ea00b54e9 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -738,6 +738,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; } } @@ -1428,6 +1432,10 @@ export const PropertyEffects = dedupingMixin(superClass => { // implement a whitelist of tag & property values that should never // be reset (e.g. .value &&