edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [edbrowse-dev] dataset / offsetWidth
@ 2019-06-16 16:24 Kevin Carhart
  2019-06-16 18:44 ` Karl Dahlke
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Carhart @ 2019-06-16 16:24 UTC (permalink / raw)
  To: edbrowse-dev


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


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

end of thread, other threads:[~2019-06-16 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 16:24 [edbrowse-dev] dataset / offsetWidth Kevin Carhart
2019-06-16 18:44 ` Karl Dahlke
2019-06-16 19:21   ` Kevin Carhart

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).