-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
getCSSProperty.js #46
base: main
Are you sure you want to change the base?
Conversation
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.
🥳
//let selector = getElementByXpath(mablInputs.variables.user.selector_xpath); | ||
|
||
// using a css selector | ||
let selector = document.querySelector(mablInputs.variables.user.selector_css); |
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 result of querySelector
isn't a selector, but rather an element. Would it make sense to change this variable name to element
and the one below this to style
?
[nit] - selector_css could be be selectorCss
to match the camel casing used below.
// using a css selector | ||
let selector = document.querySelector(mablInputs.variables.user.selector_css); | ||
|
||
let element = getComputedStyle(selector); |
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.
so I'm curious, we don't need window.getComputedStyle
here right? it seems to work fine in dev tools when I'm testing it without window. I don't much about how the scoping works for our javascript snippets. Would be an easy thing to test though.
callback(element.getPropertyValue(mablInputs.variables.user.css_property)); | ||
} | ||
|
||
function getElementByXpath(path) { |
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.
good idea having this here, it's handy :-)
No description provided.