-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
script(webdriver): Check if element is disabled based on WebDriver specification #38490
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
Conversation
expected: FAIL | ||
|
||
[test_optgroup_with_select[disabled\]] | ||
[test_option_with_optgroup[disabled\]] |
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.
optgroup
has not been check in is_actually_disabled()
servo/components/script/dom/element.rs
Lines 1819 to 1822 in 4b7d659
// TODO: | |
// an optgroup element that has a disabled attribute | |
// a menuitem element that has a disabled attribute | |
// a fieldset element that is a disabled fieldset |
2e1ebef
to
c47c6c6
Compare
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
c47c6c6
to
079e2a2
Compare
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.
Can you also add doc for fn handle_is_enabled
?
// Step 1.2 | ||
// The spec suggests that we immediately return false if the above is not true. | ||
// However, it causes disabled option element to not be considered as disabled. | ||
// Hence, here we also check if the element itself is actually disabled. | ||
if disabled { | ||
return true; | ||
} |
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.
// Step 1.2 | |
// The spec suggests that we immediately return false if the above is not true. | |
// However, it causes disabled option element to not be considered as disabled. | |
// Hence, here we also check if the element itself is actually disabled. | |
if disabled { | |
return true; | |
} | |
return disabled; |
If it is option element, then we won't enter step 1 in the first place. It exposes other problems. Just follow the spec.
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 steps 1 include option element https://w3c.github.io/webdriver/#dfn-disabled
1.1. For each inclusive ancestor ancestor of element:
1.1.1. If ancestor is an optgroup element or ancestor is a select element, and ancestor is actually disabled, return true.
1.2. Return false.
You can see that if it's an option it will go to steps 1.1, but in steps 1.1.1. it will only check optgroup and select.
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 you mean the spec has some problem here?
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.
I think yes
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.
Can you file a spec issue for this?
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.
Can you file a spec issue for this?
I've opened w3c/webdriver#1917
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
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.
LGTM. But there were two marked resolved but not changed.
Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
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.
@xiaochengh This is ready to merge.
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.
Thanks for reviewing, @yezhizhen!
Checking if an element is disabled based on spec. Fix the command
Is Element Enabled
.Testing: Covered in WPT (
./tests/wpt/tests/webdriver/tests/classic/is_element_enabled/enabled.py
)