edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] predefined classes
Date: Mon, 03 Jul 2017 07:48:59 -0400	[thread overview]
Message-ID: <20170603074859.eklhad@comcast.net> (raw)
In-Reply-To: <8737ae4qqv.fsf@the-brannons.com>

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

I still like the idea of doing as much as we can in startwindow.js, but when I tried to move a few more things in that direction I ran into trouble.
The TextNode class, that's an easy one right?


TextNode = function() {
this.data = "";
if(arguments.length > 0) {
// do your best to turn the arg into a string.
this.data += arguments[0];
}
}

We won't talk about the 40 lines of mozilla specific C needed to do the same thing in jseng-moz.cpp.  Yuck!
But ... there's a catch.
I can no longer instantiate a TextNode object using the C API.
Sure I can invoke new TextNode in js all I want, it works just fine,
but if it's not a C defined class I can't use the C primitives to spin off objects therefrom.
"So what" you might ask, and you're almost right.
But there is one path of code that needs to do this.
innerHTML = "html string"
parses and renders the html code from within the js process, and objects are created using the native methods, and that includes a TextNode object for each fragment of text on the page.
"So just make a native method to create that particular object, or better still, a native function call you can use to invoke document.createTextNode(), which is how you should be making all your text nodes all the time anyways for consistency."
Right, but I was trying to cut down on the code in jseng-moz.cpp, not make it bigger.
Well it still might be the right path, since I could then move more classes into startwindow.js and use this new native function to call createElement, which is how we should be creating all our nodes anyways for consistency.
So it may still be the right thing to do but I got discouraged / busy with other things and stopped working on it.
I'll wait to see if you have any thoughts.

Meantime I think we should / must go forward with the duktape conversion, whoever has the time and energy for that one.
I'd like to step up, but I am spending all my waking thoughts, and perhaps my last dollar, even dollars I don't have (on credit cards etc) trying to keep my son out of jail for a crime he didn't commit.
For those of you across the pond who don't know, innocent people go to jail all the time in the U.S., and we're ok with that, in fact we love the idea, if the last election is any indicator.
But I digress.
If anyone can help with the duk conversion I'll try to coordinate with my thoughts on moving code from C to js, whence it need not be "converted" any more,
if we can work around some wrinkles, but I don't think that should stop or postpone the conversion, because the clock is ticking.

Thanks for listening.

Karl Dahlke

      reply	other threads:[~2017-07-03 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-02  0:52 Karl Dahlke
2017-07-02 18:51 ` Chris Brannon
2017-07-03 11:48   ` Karl Dahlke [this message]

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=20170603074859.eklhad@comcast.net \
    --to=eklhad@comcast.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).