[fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Alexey Torgashin via fpc-pascal

@Michael Van Canneyt
I didn't test but I hope this package can parse this _minified_ CSS 
file? Attached on the forum


https://forum.lazarus.freepascal.org/index.php/topic,58853.msg438550.html#msg438550

It has many tricks. E.g. @media blocks (@media supports nested blocks, 
not only 1 level), e.g. {} block for N classes, e.g. weird class names.


Alexey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Michael Van Canneyt via fpc-pascal




On Sun, 27 Mar 2022, Alexey Torgashin via fpc-pascal wrote:


@Michael Van Canneyt
I didn't test but I hope this package can parse this _minified_ CSS file?


Minified or not is normally not relevant for parsing.


Attached on the forum

https://forum.lazarus.freepascal.org/index.php/topic,58853.msg438550.html#msg438550

It has many tricks. E.g. @media blocks (@media supports nested blocks, not 
only 1 level), e.g. {} block for N classes, e.g. weird class names.


Nested blocks are supported.

But weird class names:


extractcssclasses brackets.min.css -o out

Exception at 004C107B: ECSSParser:
Error: line 9, pos 18: Unexpected token: Got ctkIDENTIFIER (as UTF8String: 
"zoom"), expected: ctkCOLON .

"*zoom", really ? That's not even valid CSS syntax.

I checked 2 EBNF grammars: neither will allow this. 
I checked the W3 spec: Confirms this is simply not valid syntax.


Browsers are simply very forgiving for all the junk found in CSS files:
The CSS syntax is so sloppy, almost impossible to cover all cases. 
That's why there are a lot of test files.


But patches to make the implementation more forgiving are welcome. 
I suppose things like *zoom can be easily supported.


Do you have the unminified file ? So I can see how to interpret the '*zoom':
treat as '* zoom' or as identifier '*zoom'

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Alexey Torgashin via fpc-pascal

"*zoom", really ? That's not even valid CSS syntax.

I checked 2 EBNF grammars: neither will allow this. I checked the W3
spec: Confirms this is simply not valid syntax.


But "*.nnn" is valid one.
https://css-tricks.com/almanac/selectors/u/universal/

So if the "*" has meaning in one context, it is not the id-char, it is 
special construct.




Do you have the unminified file ?


nope.


treat as '* zoom' or as identifier '*zoom'


as "* zoom".

Alexey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Michael Van Canneyt via fpc-pascal




On Sun, 27 Mar 2022, Alexey Torgashin via fpc-pascal wrote:


"*zoom", really ? That's not even valid CSS syntax.

I checked 2 EBNF grammars: neither will allow this. I checked the W3
spec: Confirms this is simply not valid syntax.


But "*.nnn" is valid one.
https://css-tricks.com/almanac/selectors/u/universal/

So if the "*" has meaning in one context, it is not the id-char, it is 
special construct.


The problem is that spaces are meaningful. 
so * zoom and *zoom are not the same.






Do you have the unminified file ?


nope.


treat as '* zoom' or as identifier '*zoom'


as "* zoom".


Thanks, I wil check...

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] New FCL-CSS package in the GitLab repo

2022-03-27 Thread Michael Van Canneyt via fpc-pascal




On Sun, 27 Mar 2022, Michael Van Canneyt via fpc-pascal wrote:




On Sun, 27 Mar 2022, Alexey Torgashin via fpc-pascal wrote:


"*zoom", really ? That's not even valid CSS syntax.

I checked 2 EBNF grammars: neither will allow this. I checked the W3
spec: Confirms this is simply not valid syntax.


But "*.nnn" is valid one.
https://css-tricks.com/almanac/selectors/u/universal/


I did some more checking. As a selector * can be used in some cases: 
the universal selector. but it can not be used as a property name.


in your file:

.clearfix{*zoom:1}

*zoom is a property name, not a selector. and properties must be
identifiers. According to the spec, identifiers do not start with a *.

I will add some options to interpret "*zoom" as a property name, but they will
off by default.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal