You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: on mutation, apply cascade to new elements only (#1440)
* fix: on mutation, cascade to new elements only
When a cascade is triggered by a mutation observer, copy attributes down
to the newly created elements only. Previously, I had code implemented
that tried to do this but it wasn't working. It was finding which
cascade selectors matched the new elements, but then copied the
attributes to _all_ elements that matched those selectors.
* update changelog
* move IE11 observer reattach to same branch as detach
* update changelog
* Update CHANGELOG-1.x.md
* fix incorrect iteration over cascading attrNames
* Update CHANGELOG-1.x.md
Co-authored-by: [ Cassondra ] <[email protected]>
* add jsdoc params to _cascadeAttribute
* Update elements/pfelement/src/pfelement.js
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: [ Cassondra ] <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG-1.x.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
1
# 1.10.1 (2021)
2
2
3
-
-[](https://github.com/patternfly/patternfly-elements/commit/) fix: pfelement - only resetContext on a nested child element during contextUpdate if resetContext is available on the child
4
-
-[fdc60ab](https://github.com/patternfly/patternfly-elements/commit/) fix: pfe-tabs issue with active border color on horizontal/wind (#1585)
3
+
-[b717636](https://github.com/patternfly/patternfly-elements/commit/b717636782ebce33b4549ba9f68ffff09c036889) fix: pfelement - only resetContext on a nested child element during contextUpdate if resetContext is available on the child
4
+
-[7f9c30e](https://github.com/patternfly/patternfly-elements/commit/7f9c30e0a312e538b1787a91824c6e84d1aa261a) fix: pfe-tabs issue with active border color on horizontal/wind (#1585)
5
+
-[](https://github.com/patternfly/patternfly-elements/commit/) fix: on mutation, apply cascade to new elements only
@@ -954,23 +956,39 @@ class PFElement extends HTMLElement {
954
956
returnpropName;
955
957
}
956
958
957
-
_copyAttributes(selectors,set){
958
-
selectors.forEach((selector)=>{
959
-
set[selector].forEach((attr)=>{
960
-
this._copyAttribute(attr,selector);
959
+
_cascadeAttributes(selectors,set){
960
+
selectors.forEach(selector=>{
961
+
set[selector].forEach(attr=>{
962
+
this._cascadeAttribute(attr,selector);
961
963
});
962
964
});
963
965
}
964
966
965
-
_copyAttribute(name,to){
967
+
/**
968
+
* Trigger a cascade of the named attribute to any child elements that match
969
+
* the `to` selector. The selector can match elements in the light DOM and
970
+
* shadow DOM.
971
+
* @param {String} name The name of the attribute to cascade (not necessarily the same as the property name).
972
+
* @param {String} to A CSS selector that matches the elements that should received the cascaded attribute. The selector will be applied within `this` element's light and shadow DOM trees.
0 commit comments