* [Edbrowse-dev] immediate evaluation of js on appendChild
@ 2016-06-15 4:17 Kevin Carhart
[not found] ` <20160515130957.eklhad@comcast.net>
2016-06-17 2:00 ` Karl Dahlke
0 siblings, 2 replies; 4+ messages in thread
From: Kevin Carhart @ 2016-06-15 4:17 UTC (permalink / raw)
To: edbrowse-dev
Suppose a site author has a piece of javascript stored in the .text
property of a script element. It's only a string. But now controlling JS
code runs appendChild of that script element. Possibly insertBefore too.
Now that javascript code is part of the DOM. I think this code is
supposed to evaluate immediately. Does this ring a bell and if it's
something that should happen but currently doesn't, what would be an
appropriate place to implement it?
Maybe it could be done directly in startwindow.js, because side effects
from the code in question will be dealt with as the chunk of JS is itself
addressed line by line and the JS functions trigger the existing side
effects code. eval() comes to mind though I think it is considered
harmful.
thanks
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Edbrowse-dev] immediate evaluation of js on appendChild
[not found] ` <20160515130957.eklhad@comcast.net>
@ 2016-06-15 23:27 ` Kevin Carhart
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Carhart @ 2016-06-15 23:27 UTC (permalink / raw)
To: Karl Dahlke; +Cc: edbrowse-dev
Hi Karl
Yes.... could you go to http://carhart.net/~kevin/immediate.html?
In edbrowse nothing will happen so please 'ub' for the HTML source.
Now if I bail out and try it in my firefox,
the alert will fire. I'm not sure precisely which line it occurs on. But
there is not an eval() in javascript, so I think there must be evaluation
supplied by the DOM.
I believe this is the purpose of the iframe formulation in the google
groups page we were talking about a while ago. immediate.html is a
simpler version of the construction that they use. Since google is doing
it, it may be a common phrasing. Question for Steven Terpe if you're
around: I think you said you recognized the phrasing
frame.contentDocument.open();
frame.contentDocument.write(html);
frame.contentDocument.close();
Do you know if this is used a lot?
thanks
Kevin
On Wed, 15 Jun 2016, Karl Dahlke wrote:
> Is there some simple js you could whip up and post,
> as an example, so I know what you're talking about?
>
> Karl Dahlke
>
--------
Kevin Carhart * 415 225 5306 * The Ten Ninety Nihilists
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] immediate evaluation of js on appendChild
2016-06-15 4:17 [Edbrowse-dev] immediate evaluation of js on appendChild Kevin Carhart
[not found] ` <20160515130957.eklhad@comcast.net>
@ 2016-06-17 2:00 ` Karl Dahlke
2016-06-17 19:48 ` Kevin Carhart
1 sibling, 1 reply; 4+ messages in thread
From: Karl Dahlke @ 2016-06-17 2:00 UTC (permalink / raw)
To: edbrowse-dev
> frame.contentDocument.write(html);
The key here is, I think, when we design the new Iframe object,
that Iframe.contentDocument.write() somehow invokes the innerHTML machinery.
That parses and executes html immediately,
though if that html has <script> as in your example,
the script might not run immediately, as another script is already running,
but I don't think that's a problem,
as long as the html dom objects are created immediately, which they are,
because innerHTML requires that as we already saw.
If my life crises abbate I'll work on this,
because I can see it really needs to be done,
and meantime I'll just advise on the design.
Kevin thanks for uncovering this.
I really think missing dom pieces and interactions are 90% of our
webpage troubles, while the really hard asynchronous ajax java methods etc
are only a small percentage of our troubles.
So filling in missing dom pieces, like Iframe, is probably
the biggest bang for the buck.
Karl Dahlke
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Edbrowse-dev] immediate evaluation of js on appendChild
2016-06-17 2:00 ` Karl Dahlke
@ 2016-06-17 19:48 ` Kevin Carhart
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Carhart @ 2016-06-17 19:48 UTC (permalink / raw)
To: Karl Dahlke; +Cc: edbrowse-dev
Hi Karl
> If my life crises abbate
I hope they do. Here's to better times.
> Kevin thanks for uncovering this.
You are welcome! It's good that the users have been
submitting problems, because this got me rolling and
now I have the itch to get something out the door.
I have found a few different corrections which I need to
write up and submit.
> The key here is, I think, when we design the new Iframe object,
> that Iframe.contentDocument.write() somehow invokes the innerHTML
> machinery.
Aha! That makes sense. Hook into the existing innerHTML
machinery and take advantage of it.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-17 19:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 4:17 [Edbrowse-dev] immediate evaluation of js on appendChild Kevin Carhart
[not found] ` <20160515130957.eklhad@comcast.net>
2016-06-15 23:27 ` Kevin Carhart
2016-06-17 2:00 ` Karl Dahlke
2016-06-17 19:48 ` 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).