-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #113 - Add support for CSSStyleDeclaration
property get, set, and remove
#114
Fix #113 - Add support for CSSStyleDeclaration
property get, set, and remove
#114
Conversation
…get, set, and remove - CSSStyleDeclaration.getPropertyValue() - CSSStyleDeclaration.setProperty() - CSSStyleDeclaration.removeProperty()
@@ -82,6 +82,21 @@ class CSSStyleDeclaration extends Map { | |||
refs.get(this).setAttribute('style', value); | |||
} | |||
|
|||
getPropertyValue(name) { | |||
const self = this[PRIVATE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own understanding/curiosity, what is the difference between this
and this[PRIVATE]
(which is a getter that returns this
)?
It seems like the cssText
getters and setters are the only ones that use this
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
points at the proxy, not at the original Map
reference ... the constructor
returns a Proxy ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, the proxy passes the this[PRIVATE]
getter back to the original object and accesses that this
. Thanks for the explanation 🙂
@@ -81,6 +81,21 @@ export class CSSStyleDeclaration extends Map { | |||
refs.get(this).setAttribute('style', value); | |||
} | |||
|
|||
getPropertyValue(name) { | |||
const self = this[PRIVATE]; | |||
return handler.get(self, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handler is for proxy thing ... once you have the original Map that is holding all values, you gotta do like:
return self.get(uhyphen(name));
got it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, never mind ... updateKeys
needs to happen, so this was unnecessary optimization. All good!
Thanks for the review, merge, and release @WebReflection 🎉 |
See #653 (comment) We can allow this to run now since I added support for `setProperty` in `linkedom` ⏩ WebReflection/linkedom#114
Add support for
CSSStyleDeclaration
property get, set, and remove:CSSStyleDeclaration.getPropertyValue()
CSSStyleDeclaration.setProperty()
CSSStyleDeclaration.removeProperty()
Fix #113