edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Kevin Carhart <kevin@carhart.net>
To: edbrowse-dev@lists.the-brannons.com
Subject: [edbrowse-dev] dataset / offsetWidth
Date: Sun, 16 Jun 2019 09:24:58 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.21.1906152356310.29748@carhart.net> (raw)


Thanks for the parallel downloading feature, Karl.  I haven't used it yet, 
but I did track down something interesting today.

The site maerskline.com gave an error that it could not address the 'url' 
property of an object that didn't have it.  I tracked this down to:

this.url = this.el.dataset.url

It turns out that properties in HTML tags that begin with "data-" are 
supposed to be available for retrieval with the "data-" stripped off.  So 
the original HTML page had a div that said

<div class="p-page__header__options" 
data-url="/api_sc9/DecisionTree/GetStage?itemID={option-id}" 
data-cookie="">

And now it's expecting to be able to find that under (that 
div).dataset.url

So I thought we could do this in pushAttributes maybe?

First I established an empty "dataset" object in domLink.  Then in 
pushAttributes, given the loop over attributes 'a' with values 'v', I 
wrote this, where substring is just some internet code.  I'm just 
stripping off the first five characters.  Karl, do you have something in 
stringfile.c that can do that?

if (strncmp(a[i],"data-",5)==0)
{
dso = get_property_object(t->jv,"dataset");
substring(a[i],token1,6,strlen(a[i])-(strlen(a[i]-5)));
set_property_string(dso, token1,v[i]);
}

So after this change it finds the dataset.url and proceeds.  But there was 
one more problem.  It wants to call ie:

ie = function (e) {
return e.offsetWidth;
};

Where e is an element, this.el.

So it expects the broad height and width properties to exist on elements. 
Does it make any sense for an element to have those?  Anyway, could we 
throw them on c.prototype?

c.prototype.clientHeight = 768;
c.prototype.clientWidth = 1024;
c.prototype.offsetHeight = 768;
c.prototype.offsetWidth = 1024;
c.prototype.scrollHeight = 768;
c.prototype.scrollWidth = 1024;
c.prototype.scrollTop = 0;
c.prototype.scrollLeft = 0;

I used everything on this!  breakpoints, snapshotting, uvw trace etc


thanks
Kevin


             reply	other threads:[~2019-06-16 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16 16:24 Kevin Carhart [this message]
2019-06-16 18:44 ` Karl Dahlke
2019-06-16 19:21   ` Kevin Carhart

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.DEB.2.21.1906152356310.29748@carhart.net \
    --to=kevin@carhart.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).