RESOLVED FIXED134826
Anchor, Area and Link elements should *not* respond to :enabled selector if they have an href attribute
https://bugs.webkit.org/show_bug.cgi?id=134826
Summary Anchor, Area and Link elements should *not* respond to :enabled selector if t...
Bruno Abinader
Reported 2014-07-10 21:50:52 PDT
What steps will reproduce the problem? 1. Open attached testcase What is the expected output? What do you see instead? Query for :enabled should be non-null.
Attachments
Testcase (508 bytes, text/html)
2014-07-10 21:51 PDT, Bruno Abinader
no flags
Patch (4.85 KB, patch)
2014-07-23 14:29 PDT, Bruno Abinader
no flags
Patch (5.06 KB, patch)
2014-07-24 06:39 PDT, Bruno Abinader
no flags
Rebased patch (5.10 KB, patch)
2014-07-24 08:25 PDT, Bruno Abinader
no flags
Patch (5.21 KB, patch)
2014-09-26 10:09 PDT, Bruno Abinader
no flags
Patch (w/ updated code for Anchor element) (6.15 KB, patch)
2014-09-26 13:42 PDT, Bruno Abinader
darin: review+
Patch (6.64 KB, patch)
2014-09-29 08:33 PDT, Bruno Abinader
no flags
Patch (6.64 KB, patch)
2014-09-29 08:41 PDT, Bruno Abinader
no flags
Bruno Abinader
Comment 1 2014-07-10 21:51:25 PDT
Created attachment 234744 [details] Testcase
Bruno Abinader
Comment 2 2014-07-10 21:53:25 PDT
Spec: html.spec.whatwg.org/#selector-enabled
Bruno Abinader
Comment 3 2014-07-23 14:29:08 PDT
Darin Adler
Comment 4 2014-07-23 15:28:25 PDT
Comment on attachment 235379 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=235379&action=review Patch doesn’t apply. > Source/WebCore/css/SelectorCheckerTestFunctions.h:67 > + else if (isHTMLAnchorElement(element) || isHTMLAreaElement(element)) > + return element->isLink(); Minor style nit: We don’t do else after return. Performance nit: Should check the isLink bit first, before looking at the the element type, for better performance.
Bruno Abinader
Comment 5 2014-07-24 06:39:26 PDT
Bruno Abinader
Comment 6 2014-07-24 08:25:01 PDT
Created attachment 235431 [details] Rebased patch
WebKit Commit Bot
Comment 7 2014-07-27 19:28:21 PDT
Comment on attachment 235431 [details] Rebased patch Clearing flags on attachment: 235431 Committed r171671: <http://trac.webkit.org/changeset/171671>
WebKit Commit Bot
Comment 8 2014-07-27 19:28:23 PDT
All reviewed patches have been landed. Closing bug.
Bruno Abinader
Comment 9 2014-09-26 08:23:16 PDT
Anchors, Areas & Links are no longer matched by :enabled CSS selector [1], according to this discussion from W3C Bugzilla [2]. Thus, I'm going to revert these changes. Links: [1] https://html5.org/r/8818 [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=26622
Bruno Abinader
Comment 10 2014-09-26 10:09:22 PDT
Bruno Abinader
Comment 11 2014-09-26 13:42:05 PDT
Created attachment 238734 [details] Patch (w/ updated code for Anchor element)
Darin Adler
Comment 12 2014-09-28 16:23:12 PDT
Comment on attachment 238734 [details] Patch (w/ updated code for Anchor element) View in context: https://bugs.webkit.org/attachment.cgi?id=238734&action=review Hope nobody shipped a browser between when we changed this and reverted the change! > Source/WebCore/css/SelectorCheckerTestFunctions.h:68 > - bool isEnabled = false; > if (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element)) > - isEnabled = !element->isDisabledFormControl(); > - else if (element->isLink()) > - isEnabled = is<HTMLAnchorElement>(element) || is<HTMLAreaElement>(element); > - return isEnabled; > + return !element->isDisabledFormControl(); > + return false; This now seems like it would be clearer with && than with if.
Bruno Abinader
Comment 13 2014-09-29 08:27:59 PDT
(In reply to comment #12) > (From update of attachment 238734 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=238734&action=review > > Hope nobody shipped a browser between when we changed this and reverted the change! > > > Source/WebCore/css/SelectorCheckerTestFunctions.h:68 > > - bool isEnabled = false; > > if (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element)) > > - isEnabled = !element->isDisabledFormControl(); > > - else if (element->isLink()) > > - isEnabled = is<HTMLAnchorElement>(element) || is<HTMLAreaElement>(element); > > - return isEnabled; > > + return !element->isDisabledFormControl(); > > + return false; > > This now seems like it would be clearer with && than with if. Indeed, the odds of live specifications, I guess ;)
Bruno Abinader
Comment 14 2014-09-29 08:33:51 PDT
Bruno Abinader
Comment 15 2014-09-29 08:41:54 PDT
WebKit Commit Bot
Comment 16 2014-09-29 09:31:37 PDT
Comment on attachment 238857 [details] Patch Clearing flags on attachment: 238857 Committed r174064: <http://trac.webkit.org/changeset/174064>
Benjamin Poulain
Comment 17 2014-10-07 17:23:25 PDT
Instead of removing the tests, you should have modified css-selector-enabled-links.html to ensure that :enabled *do not* match links. Can you please create a new patch to test this properly?
Bruno Abinader
Comment 18 2014-10-08 14:19:52 PDT
(In reply to comment #17) > Instead of removing the tests, you should have modified css-selector-enabled-links.html to ensure that :enabled *do not* match links. > > Can you please create a new patch to test this properly? Sure, I'll re-add the tests with updated results.
Benjamin Poulain
Comment 19 2014-10-08 23:56:34 PDT
(In reply to comment #18) > (In reply to comment #17) > > Instead of removing the tests, you should have modified css-selector-enabled-links.html to ensure that :enabled *do not* match links. > > > > Can you please create a new patch to test this properly? > > Sure, I'll re-add the tests with updated results. Thanks. Please CC me on the bug.
Note You need to log in before you can comment on or make changes to this bug.