[Feature request] Implement unprefixed :read-only and :read-write pseudo-classes

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

[Feature request] Implement unprefixed :read-only and :read-write pseudo-classes

Unread post by SemiKebab » 2024-01-09, 11:59

Please consider implementing the :read-only and :read-write pseudo-classes, unprefixed.

Note they are implemented in other browser for a long time: https://caniuse.com/css-read-only-write.

Actually, Pale Moon already implements the "-moz" prefixed selectors. So it's just a matter of adding support for the unprefixed selectors, also keeping the prefixed ones for now, as does Firefox.

Use case: Adding a grey background to input elements that have a readonly property:

Code: Select all

input:not([type]):read-only,
input[type="text"]:read-only,
textarea:read-only {
    background-color: #F2F2F2;
}

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: [Feature request] Implement unprefixed :read-only and :read-write pseudo-classes

Unread post by SemiKebab » 2024-01-09, 14:56

As a side note, the following CSS doesn't work in Pale Moon, nor in Chrome:

Code: Select all

input[type="text"]:-moz-read-only,
input[type="text"]:read-only {
    background-color: #F2F2F2;
}
The solution is to use two rulesets:

Code: Select all

input[type="text"]:-moz-read-only {
    background-color: #F2F2F2;
}
input[type="text"]:read-only {
    background-color: #F2F2F2;
}
It's a case where the unrecognized selectors discard the entire ruleset.

For both browsers: ":read-only" unrecognized by Pale Moon and ":-moz-read-only" unrecognized by Chrome.

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: [Feature request] Implement unprefixed :read-only and :read-write pseudo-classes

Unread post by SemiKebab » 2024-01-09, 15:16

By the way, I just realized that for my use case (and I suppose for most use cases), instead of bothering with ":read-only/:-moz-read-only", I just had to use "[readonly]".

Though, this feature request is still valid :)

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: [Feature request] Implement unprefixed :read-only and :read-write pseudo-classes

Unread post by SemiKebab » 2024-01-12, 07:32

Again as a side note, about the "ruleset entirely discarded" issue (my 2nd post), people encountered it on MDN, here and here.

They solved the issue by enclosing the selectors in an :is() list, which does forgiving parsing. Although it works, this solution doesn't look pretty (what to blame is the legacy, prehistoric unforgiving parsing).