Closed camchenry closed 1 month ago
@camchenry very well this is fantastic, this is real help for me. Thank you so much for the help catching the problem and code to fix it. It will be merged immediately after a small review once tested against wpt.
@dperini Thanks, let me know if there is anything I can do to help with this PR. I did test it out in Chrome 127 on macOS and it looked okay, but I didn't try any other browsers so far.
@camchenry it is better if I apply your fix as is, without further delays since there have been enough testing. Optimizations can be applied later if they still make this change to pass wpt requirements.
With the current implementation of the
:disabled
selector, there are two main issues:legend
. Currently, the check for if the legend element contains the element doesn't handle if the first legend element doesn't exist in the fieldset. Specifically,(n=s.ancestor("fieldset",e))&&(n=s.first("legend",n))&&!n.contains(e))
returns false becausen=s.first("legend",n)
evaluates tonull
which is falsey, so the whole AND expression evaluates to false. Rather, if there is no legend element, we do not need to consider if the element is contained within the legend element and can solely focus on whether it is disabled or a descendant of a disabled fieldset.Since the original
test/w3c/html/semantics/selectors/pseudo-classes/disabled.html
web-platform-test was added, it has been updated with additional test-cases. So I have added those here to ensure this works correctly.