Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Cooperate with ShadyCSS to appropriately scope changes to class/className #54

Merged
merged 4 commits into from
Nov 9, 2016

Conversation

sorvell
Copy link
Contributor

@sorvell sorvell commented Nov 9, 2016

Implements class/className setters for all elements using ShadyCSS's setElementClass(element, classString) api to provide automatic style scoping when class changes.

Should not be merged before webcomponents/shadycss#25.

Steven Orvell added 2 commits November 1, 2016 15:39
@@ -371,6 +350,14 @@ let nativeImportNode = Document.prototype.importNode;
let nativeSetAttribute = Element.prototype.setAttribute;
let nativeRemoveAttribute = Element.prototype.removeAttribute;

export let setAttribute = function(attr, value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not take the node as the first argument?
setAttribute(node, attr, value) would remove the indirection used later.

@@ -656,7 +643,7 @@ let ElementMixin = {


setAttribute(name, value) {
nativeSetAttribute.call(this, name, value);
setAttribute.call(this, name, value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be setAttribute(this, name, value)

return this.getAttribute('class');
},
set(value) {
setAttribute.call(this, 'class', value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setAttribute(this, 'class', value)

Copy link
Contributor

@dfreedm dfreedm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, the setAttribute function will have to be indirectly called somewhere, better for it to be more performant on the element.setAttribute case.

…`name` changes, (2) the `slot` attribute changed and the parent has a shadowRoot with insertion point. Previously any attribute change on a patched node would distribute if the parent had a shadowRoot with insertion points.
@sorvell sorvell merged commit c162774 into master Nov 9, 2016
@sorvell sorvell deleted the class-scoping branch November 9, 2016 19:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants