edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] acid[0]
Date: Sun, 20 Aug 2017 10:33:37 -0400	[thread overview]
Message-ID: <20170720103337.eklhad@comcast.net> (raw)
In-Reply-To: <alpine.LRH.2.03.1708191708530.31837@carhart.net>

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

Ok Kevin, all that free software is just too irresistable!
I put both functions in startwindow.js and pushed, so everybody have a look.

The css parser works like a dream!
You can even do it stand alone.

duk -i startwindow.js

parser = new cssjs;
list = parser.parseCSS(css_string);

list is an array of the css descriptors in the string.
Each is an object with members: selector, rules, comment.
The selector is something like "p.snork".
Rules is another array of all the keyword value pairs like  bgcolor = white
It's so simple and clean.
I took the ridiculous <style> tag out of acid3 and pushed it through the parser, and it worked perfectly.
45 descriptors corresponding to the contents of that <style> tag.

querySelectorAll is not as simple.
As Kevin pointed out, other websites use the same construct, maybe even the same code, and I don't want their function to collide with our function, especially if they work somewhat differently, so I call ours eb$qs.

eb$qs("div")

But there's another problem.
The code creates the function querySelectorAll, or in our case eb$qs, and in doing so it creates a temporary <div> tag.
That doesn't work unless we have a framework in place.
So I put a wrapper around it:  eb$qs$start().
That sets everything up to then run eb$qs as often as you like.
Eventually edbrowse will call eb$qs$start() after the html document is browsed and before the first javascript runs.

eb$qs$start()
parser.parseCSS() on every style tag in the document and every file <link type=css href=>
Then map those values onto the objects by applying eb$qs to each selector in each css descriptor.

But there are more problems.
Try it with jsrt.
Set db3 so you can see what is going on.
browse, jdb, eb$qs$start()
and now you're ready to go.
list = eb$qs("script");
Holy crap it works, list is an array of 9 objects for the 9 scripts in jsrt.
Step through each one and look at list[i].data.
That is the contents of each script.
This also works for "p" "a", and other such things.
It doesn't work for "table.filbert", even though we have a <table class=filbert> tag.
It calls a method getAttributeNode which we don't have. Oops.
That's probably our omission, and something we should address anyways.

Then try eb$qs("#jkl");
That doesn't work either.
We are missing the compareDocumentPosition() method.

So we can't move forward on this until we fill in some missing pieces in our DOM.
Any volunteers to implement getAttributeNode() or compareDocumentPosition()?
The former is easier, and more important, than the latter.

Karl Dahlke

  reply	other threads:[~2017-08-20 14:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19 15:38 Karl Dahlke
2017-08-19 22:53 ` Kevin Carhart
2017-08-19 23:08   ` Karl Dahlke
2017-08-19 23:33     ` Kevin Carhart
2017-08-20  0:00       ` Karl Dahlke
2017-08-20  0:37         ` Kevin Carhart
2017-08-20 14:33           ` Karl Dahlke [this message]
2017-08-20 20:00             ` Kevin Carhart
2017-08-20 20:08               ` [Edbrowse-dev] getAttributeNode / setAttributeNode Kevin Carhart
2017-08-20 20:24                 ` Karl Dahlke
2017-08-20 20:56                   ` Kevin Carhart
2017-08-20 21:59                     ` Kevin Carhart
     [not found]                       ` <20170721105041.eklhad@comcast.net>
2017-08-21 19:11                         ` Kevin Carhart
2017-08-21 20:01                           ` Karl Dahlke
2017-08-24  9:54                             ` Kevin Carhart
2017-08-24  9:57                             ` Kevin Carhart
2017-08-25  8:19                             ` Kevin Carhart
2017-08-25 22:09                               ` [Edbrowse-dev] whitespace nodes Kevin Carhart
2017-08-25 22:56                                 ` Karl Dahlke
2017-08-26  4:25                                   ` [Edbrowse-dev] (something other than) " Kevin Carhart
2017-09-02  9:03                                     ` Adam Thompson
2017-09-02 15:42                                       ` Karl Dahlke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170720103337.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).