This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26622 - :enabled shouldn't match links, since they have no disabled state
Summary: :enabled shouldn't match links, since they have no disabled state
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-21 05:54 UTC by contributor
Modified: 2014-09-24 22:29 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2014-08-21 05:54:59 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting.html
Multipage: http://www.whatwg.org/C#pseudo-classes
Complete: http://www.whatwg.org/c#pseudo-classes
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
:enabled shouldn't match links, since they have no disabled state

Posted from: 98.110.194.132 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:34.0) Gecko/20100101 Firefox/34.0
Comment 1 Boris Zbarsky 2014-08-21 05:55:59 UTC
http://www.w3.org/TR/selectors/#enableddisabled seems pretty clear that :enabled should only match things that can in fact be disabled....
Comment 2 Boris Zbarsky 2014-08-21 05:56:55 UTC
And there is no clear web compat need for the current spec, of course, nor obvious reasoning that I can see.
Comment 3 Edward O'Connor 2014-09-03 16:09:09 UTC
FWIW, I agree with Boris.
Comment 4 Ian 'Hixie' Hickson 2014-09-03 17:29:39 UTC
Looks like this is the way the spec has been since February 2009. I don't see any record of why.

Given that only Chrome seems to do this, I guess the spec should change.

Tab, any opinion on this?
Comment 5 Ian 'Hixie' Hickson 2014-09-03 17:38:18 UTC
Apparently WebKit has recently been updated to do this too, actually.

I don't have a strong opinion one way or the other. I think it makes sense to make :link match :enabled, since it's quite possible that we'll make it possible to disable links one day. I also think there's not a very good reason to have specced this in the first place, though. The biggest reason I have to not change the spec is that flip-flopping the spec is really bad for morale amongst browser vendors, and runs a huge risk of making people ignore the spec going forward. But if pretty much all the deployed browsers do something different than what the spec says, it's easy to argue that the spec is just wrong.
Comment 6 Domenic Denicola 2014-09-03 18:24:11 UTC
Speaking just as a web developer I would like to be able to disable links (preferably with the [disabled] attribute), and have :enabled/:disbabled apply to them. I have many times had to add class="disabled" to my links, and change my CSS selectors from :disabled { ... } to :disabled, .disabled { ... }, and change my JS code from .setAttribute("disabled", "") to .classList.add("disabled"), when refactoring from button to link or similar.
Comment 7 Boris Zbarsky 2014-09-03 19:24:14 UTC
I would be ok with links matching :enabled if they could in fact be disabled.
Comment 8 Bruno de Oliveira Abinader 2014-09-03 19:44:51 UTC
(In reply to Boris Zbarsky from comment #7)
> I would be ok with links matching :enabled if they could in fact be disabled.

+1 for that. This would maintain current specification for :enabled, as Hixie mentioned, and provide a simpler understanding of how both :enabled and :disabled selectors behaves.
Comment 9 Ian 'Hixie' Hickson 2014-09-03 21:50:32 UTC
Well we can certainly add a feature to make links be something that can be disabled, if there's vendor interest in implementing that. But would we add that feature in the absence of this forcing function?
Comment 10 Domenic Denicola 2014-09-03 22:50:39 UTC
I would ;)

More seriously, assuming this passes the Intent to Implement "does this help mobile performance?" gauntlet of blink-dev, I'd volunteer to implement disabling links via the disabled attribute in Blink. So there's some tentative vendor interest for you...
Comment 11 Ian 'Hixie' Hickson 2014-09-18 21:20:01 UTC
bz, hober: So is disabled="" on <a href=""> something you want to implement? Or is this something we should wait on for now? And if we wait, do you want :enabled to stop matching <a href=""> even though it'll start matching it eventually if we add this?
Comment 12 Edward O'Connor 2014-09-18 23:28:06 UTC
We're not strongly for or strongly against. It seems reasonable, but it's already pretty easy to disable links in practice.
Comment 13 Boris Zbarsky 2014-09-19 19:29:41 UTC
I'm strongly against having a halfway state, I think.  Past that, I have no strong views and no immediate plans to implement anything here....
Comment 14 contributor 2014-09-24 22:29:53 UTC
Checked in as WHATWG revision r8818.
Check-in comment: Make :enabled not match <a href>
https://html5.org/tools/web-apps-tracker?from=8817&to=8818