edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] css parser
@ 2018-02-13 18:41 Karl Dahlke
  2018-02-13 18:59 ` Adam Thompson
  2018-02-14  4:54 ` Kevin Carhart
  0 siblings, 2 replies; 4+ messages in thread
From: Karl Dahlke @ 2018-02-13 18:41 UTC (permalink / raw)
  To: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

Earlier posts have discussed the possibility, and the advantages, of writing our own css parser and querySelectorAll.
If we are content with handling the high runner cases, and maybe not every corner case, it might not be as hard as first appears.
(We don't handle the unusual cases now anyways.)
css selector syntax is described here.

https://www.w3.org/TR/CSS21/selector.html#grouping

There's a lot going on, but it's straightforward.
An ideal css compiler would produce a 4 dimensional structure.
I have implemented such, and it seems to work on the modest files I've tried.
(I have yet to try the monster css file from stackoverflow.)
Have a look at the comments in startwindow.js line 2105.
If you want to play with it, browse any file with at least one css file,
and in jdb,

v = mw0.cssPieces(mw0.uncomment(document.links[0].data));

Once this is shaken out, cssGather would call this instead of the third party css parser.
Then we would write our own querySelectorAll, then invoke that from within cssApply.
That's the roadmap.

Karl Dahlke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Edbrowse-dev] css parser
  2018-02-13 18:41 [Edbrowse-dev] css parser Karl Dahlke
@ 2018-02-13 18:59 ` Adam Thompson
  2018-02-14  4:54 ` Kevin Carhart
  1 sibling, 0 replies; 4+ messages in thread
From: Adam Thompson @ 2018-02-13 18:59 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: Edbrowse-dev

On Tue, Feb 13, 2018 at 01:41:31PM -0500, Karl Dahlke wrote:
> Earlier posts have discussed the possibility, and the advantages, of writing our own css parser and querySelectorAll.
> If we are content with handling the high runner cases, and maybe not every corner case, it might not be as hard as first appears.
> (We don't handle the unusual cases now anyways.)

Indeed and we've got to do something.  We need some of css but the third-party software just doesn't appear to be good enough... that's a shame.
> css selector syntax is described here.
> 
> https://www.w3.org/TR/CSS21/selector.html#grouping
> 
> There's a lot going on, but it's straightforward.
> An ideal css compiler would produce a 4 dimensional structure.
> I have implemented such, and it seems to work on the modest files I've tried.
> (I have yet to try the monster css file from stackoverflow.)
> Have a look at the comments in startwindow.js line 2105.
> If you want to play with it, browse any file with at least one css file,
> and in jdb,
> 
> v = mw0.cssPieces(mw0.uncomment(document.links[0].data));
> 
> Once this is shaken out, cssGather would call this instead of the third party css parser.
> Then we would write our own querySelectorAll, then invoke that from within cssApply.
> That's the roadmap.

Sounds good, I'll have a play with it and see what I can find.
Hopefully it all works as expected.

Thanks for working on this,
Adam.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Edbrowse-dev] css parser
  2018-02-13 18:41 [Edbrowse-dev] css parser Karl Dahlke
  2018-02-13 18:59 ` Adam Thompson
@ 2018-02-14  4:54 ` Kevin Carhart
  2018-02-14  7:59   ` Karl Dahlke
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Carhart @ 2018-02-14  4:54 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: Edbrowse-dev



This is exciting.....!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Edbrowse-dev] css parser
  2018-02-14  4:54 ` Kevin Carhart
@ 2018-02-14  7:59   ` Karl Dahlke
  0 siblings, 0 replies; 4+ messages in thread
From: Karl Dahlke @ 2018-02-14  7:59 UTC (permalink / raw)
  To: Edbrowse-dev

Some stats: on the monster stackoverflow css, their parser finds 3097 descriptors, mine finds 3711.
Who's right? Got me!

Of the 3711, there are 153 that I don't understand or haven't implemented.
Some of them, like @directives, I'm not suppose to implement.
Others I know how to address but it's one thing at a time.
Still 153 out of 3711 isn't bad for version 1.

I think querySelectorAll will come together soon, unless I'm missing something important here.

It's fun to program again, especially in js, where I can wield a regexp like a giant hammer,
where one (somewhat ugly) line of code does the equivalent of a page of C.
Chris remembrers, when we wrote version 1 of edbrowse in perl.

Karl Dahlke

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-14  7:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 18:41 [Edbrowse-dev] css parser Karl Dahlke
2018-02-13 18:59 ` Adam Thompson
2018-02-14  4:54 ` Kevin Carhart
2018-02-14  7:59   ` Karl Dahlke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).