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

* [edbrowse-dev] dataset / offsetWidth
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Karl Dahlke @ 2019-06-16 18:44 UTC (permalink / raw)
  To: edbrowse-dev

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

if (strncmp(a[i],"data-",5)==0) {
jsobjtype dso = get_property_object(t->jv,"dataset");
if(dso)
set_property_string(dso, a[i]+5, u);
}

That looks ok, do you want me to code or do you want to code and make a pull request.

I don't mind setting default heights and widths on just about everything, I guess we have to,
and it's *way* too much bother to figure out what they should really be, cause we'd have to essentially lay out the screen, and edbrowse doesn't have a screen.
But 1024 by 768 is prety heavy handed.
A span with 2 letters shouldn't take the whole screen.
I would make the height 16 the pixels of a single character, and the width like 120 or about 15 characters.
Some day when we're ambitious we can guess how much "stuff" is in that element and if it's 50 characters then make it wider,
but we have to start somewhere.
Yes you would takc these onto c.prototype.
Again do you want to or should I/

c.prototype.clientHeight = 16;
c.prototype.clientWidth = 120;
c.prototype.offsetHeight = 16;
c.prototype.offsetWidth = 120;
c.prototype.scrollHeight = 16;
c.prototype.scrollWidth = 120;
c.prototype.scrollTop = 0;
c.prototype.scrollLeft = 0;


Karl Dahlke

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

* Re: [edbrowse-dev] dataset / offsetWidth
  2019-06-16 18:44 ` Karl Dahlke
@ 2019-06-16 19:21   ` Kevin Carhart
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Carhart @ 2019-06-16 19:21 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: edbrowse-dev


> That looks ok, do you want me to code or do you want to code and make a 
pull request.

I'll do this now.  The files affected are decorate and startwindow.

> set_property_string(dso, a[i]+5, u);

Ah!  Even more concise.  Thanks.

> But 1024 by 768 is prety heavy handed.

Oh yeah, good point.  It should be just as happy with any positive number, 
at least in the present scenario.




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