CSS.supports broken! Topic is solved

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.
User avatar
JAB Creations
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2021-03-08, 10:52

CSS.supports broken!

Unread post by JAB Creations » 2022-08-23, 12:22

I came to test to see if a CSS animation would work in Pale Moon (it does) and the browser prompted an update.

Because the release notes include new implementations and in a way that are easy to implement I decided to add browser detection for Pale Moon releases.

Unfortunately CSS.supports('white-space:break-spaces') failed...and so did CSS.supports('white-space:normal')!

This was supposed to be quick and easy so, I'm not sure about adding version detection just yet...

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-23, 14:09

Try using CSS.supports('property', 'value'); instead.

Code: Select all

CSS.supports('white-space','break-spaces');
Seems our support for feeding a CSSOMString expression isn't currently working (we may need some extra code; Firefox officially supported this in v55, after our fork point)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
JAB Creations
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2021-03-08, 10:52

Re: CSS.supports broken!

Unread post by JAB Creations » 2022-08-23, 14:22

Ouch! Yeah, that works fine. Again, I get it as a developer that there is always one more thing that has to be done. However in this general case I only use CSS.supports for the browser detection. However in the future I may not remember this issue and I'm not sure who/where else this may be an existing issue. Hopefully when you folks have time to get around to that (time? what is that?) it'll be easy to implement. Thanks for the help. :thumbup:

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-23, 18:41

Well I poked at it and we do seem to have it as it was added with the initial implementation, but it does seem to be broken in some fashion.
More info/research needed. it's possible the spec changed.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-23, 19:22

Aha! The issue is that we're expecting parenthesized expressions for the conditionText.
The following returns true as-expected.

Code: Select all

CSS.supports('(white-space:break-spaces)');
Please note that this follows the CSS spec! See emphasised quote from the CSS Conditional Rules Module Level 3
supports(CSSOMString conditionText), returns boolean
When the supports(conditionText) method is invoked with a single conditionText argument:

1. If conditionText, parsed and evaluated as a <supports-condition>, would return true, return true.

2. Otherwise, If conditionText, wrapped in parentheses and then parsed and evaluated as a <supports-condition>, would return true, return true.

3. Otherwise, return false.
So we're actually following the spec here; the parentheses are required. If browsers are allowing it without parentheses then they are not following the spec. It seems at least Firefox has started accepting it without, but that was based on a draft spec text that does not match what there is now (either in draft or TR) and should be considered a bug. Filed bug #1786616 to ping Mozilla about it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
JAB Creations
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2021-03-08, 10:52

Re: CSS.supports broken!

Unread post by JAB Creations » 2022-08-23, 19:46

I don't see the point of the redundant parenthesis, how are they in any way helpful? Seems like more idiocy in the standards community like CSS scrollbar-width: thin; because it's not like we want to get RID of ambiguity across browsers and platforms. 🙄︀ I'm sure you have much more insight on this topic than I do though.

Mozilla banned me from Bugzilla like two years ago. They're extremely anti-fixing-bugs, extremely anti-common-sense, extremely anti-listening-to-users, etc. They must know what they're doing though, the Firefox market share has just been exploding the past few years. 🙄︀

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-23, 19:56

JAB Creations wrote:
2022-08-23, 19:46
I don't see the point of the redundant parenthesis, how are they in any way helpful?
They aren't redundant. It's exactly the form @supports takes.
I do find it a little odd that they went from "implied parentheses" to just stating "parentheses" though as it's actually more readable without the parentheses.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-23, 20:22

Oh, i'm a dunce misreading the spec.

They actually state that both conditions should be accepted, just the wording is not very clear!

Point 1 should pass with the parens given.
Point 2 means to say "take the string, then wrap it in parentheses, then evaluate it" so basically the spec has changed to state the inverse of the problem.

So in that case I should just add what Mozilla did for it which is a trivial addition of a parameter.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
JAB Creations
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2021-03-08, 10:52

Re: CSS.supports broken!

Unread post by JAB Creations » 2022-08-24, 11:28

Looks like that portion of the standard was poorly written because I simply don't see anything about parenthesis there. Specifications should always be updated to address ambiguity, that is one of the fundamental reasons standards exist to begin with!

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35474
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: CSS.supports broken!

Unread post by Moonchild » 2022-08-24, 11:38

It's certainly lacking in clarity if I so easily misread it!

But it is there, for sure. See attach
Attachments
spec1.png
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
JAB Creations
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2021-03-08, 10:52

Re: CSS.supports broken!

Unread post by JAB Creations » 2022-08-24, 12:50

I searched for paren...whatever, browser probably lost focus. The parenthesis are listed as the second option...with no reason to justify adding the parenthesis. Do these things get proof-read? Whatever, thanks for the clarification.

Locked