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] defaultView and getComputedStyle patch
Date: Mon, 14 Aug 2017 17:48:53 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LRH.2.03.1708141648150.4280@carhart.net> (raw)
In-Reply-To: <20170714023552.eklhad@comcast.net>



I think I've read mixed messages on what needs to be there, and that's why 
I ended up with something redundant.  It's confusing at the source. I 
think last year I had the getComputedStyle returning a 
CSSStyleDeclaration object, not just one of its properties.  I changed it 
yesterday because this usage:

document.defaultView.getComputedStyle(penultimate, '').whiteSpace

Suggests to me that the return value from getComputedStyle needs to be 
solely the CSSStyleDeclaration.style.  I was getting an error from the 
test #0 code yesterday when I returned the object, because I am off by 
one hop.  .whiteSpace exists, but it is located at 
CSSStyleDeclaration.style.whiteSpace.  I ended up with a muddle because I 
don't know which to do.  The documentation for window.getComputedStyle 
says "The returned style is a live CSSStyleDeclaration object, which 
updates itself automatically when the element's style is changed." 
Automatic updating is what the test is about I think.  But do we have to 
code something extra to make it work that way?

So here is a way of turning this into a specific question.  Is there a 
common thing in OOP where, if you just address the object on its own, it 
is the same as calling a particular method that has been designated as the 
default?  I don't remember the name for this but I feel like it exists. 
And the thing that would resolve what to do would be if this expression:

.getComputedStyle(penultimate, '').whiteSpace

Would actually reroute you under the hood to:

.getComputedStyle(penultimate, '').getPropertyValue(whiteSpace)

That's what I want to do - designate getPropertyValue to be the method 
that runs if nothing has been specified.  Is this a getter?  Is this a 
familiar idiom to anyone?

thanks
Kevin





  On Mon, 14 Aug 2017, Karl Dahlke wrote:

> I went ahead and pushed this patch because it does no harm and moves you forward, but it still confuses me.
> Your getComputedStyle function at line 759 is equivalent to
>
> function getComputedStyle(e, p) { return e.style; }
>
> The obj variable is local and goes away when the function returns.
> So why not write it my way it's a whole lot easier to understand. Unless I'm missing something.
>
> Karl Dahlke
> _______________________________________________
> Edbrowse-dev mailing list
> Edbrowse-dev@lists.the-brannons.com
> http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev
>

--------
Kevin Carhart * 415 225 5306 * The Ten Ninety Nihilists

  reply	other threads:[~2017-08-15  0:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14  4:42 Kevin Carhart
2017-08-14  6:35 ` Karl Dahlke
2017-08-15  0:48   ` Kevin Carhart [this message]
2017-08-15  1:26     ` Karl Dahlke
2017-08-15  3:05       ` Kevin Carhart
     [not found]         ` <20170715003928.eklhad@comcast.net>
2017-08-15  5:38           ` Kevin Carhart
2017-08-15  6:43             ` Karl Dahlke
2017-08-15  7:08               ` Kevin Carhart
2017-08-15  7:33                 ` Kevin Carhart
2017-08-15  8:33                   ` 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.1708141648150.4280@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).