edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Kevin Carhart <kevin@carhart.net>
To: Karl Dahlke <eklhad@comcast.net>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] acid[0]
Date: Sat, 19 Aug 2017 17:37:33 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LRH.2.03.1708191708530.31837@carhart.net> (raw)
In-Reply-To: <20170719200021.eklhad@comcast.net>



On Sat, 19 Aug 2017, Karl Dahlke wrote:

> Not sure what querySelectorAll is all about; can't we just call document.getElementsByTagName()?

It's a thing of its own.  A lot of sites' JS uses this.  For instance, in 
the nasa.gov code file vendor.js,

e.querySelectorAll("[msallowcapture^='']")
e.querySelectorAll("[selected]")
e.querySelectorAll(":checked")
a=r.querySelector("#morph-"+n)
e.querySelectorAll("[id~="+q+"-]")
e.querySelectorAll("a#"+q+"+*")

The brackets, the hash and the colon have hardcoded meanings.  And the 
syntax used here, I believe is the same selector syntax you find in CSS 
blocks.  So at the least, there's also the period and the at symbol:

   .hidden { visibility: hidden; }
   @font-face { font-family: "AcidAhemTest"; src: url(font.ttf); }


> So if an object says p.snork has bgcolor=white
> then we get the array
> a = document.getElementsByTagName("p");
> Loop over array and if obj.class == "snork" then obj.style.bgcolor = white.
> Or if the descriptor is on #instructions rather than a class of nodes, we use getElementById to find the node and then set its values.
> So I think we already have the middle third, and the last third seems reasonably easy to write.

I don't rule out that this can be done.  It depends if you want to dig in 
to the selectors language-within-a-language or use a component 
to hopefully avoid having to.  If it's fun, that's good.  If it's 
completely undesirable to learn a new mini syntax, maybe the outside 
component can do it for us.

I think even if you wanted to do a certain 
thing within the implementation that called getElements, there would need 
to be a wrapper called querySel etc which is going to receive an argument 
beginning with a symbol.  We can any kind of node math we want under the 
hood in order to select the results.

It's definitely possible that you will know how to do it, so that it 
would turn out to be less work than bringing in the outside code.  I 
don't know which of those is less work.

Kevin


  reply	other threads:[~2017-08-20  0:37 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 [this message]
2017-08-20 14:33           ` Karl Dahlke
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=alpine.LRH.2.03.1708191708530.31837@carhart.net \
    --to=kevin@carhart.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    --cc=eklhad@comcast.net \
    /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).