From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] suggested additions
Date: Sun, 3 Sep 2017 19:38:46 -0700 (PDT) [thread overview]
Message-ID: <alpine.LRH.2.03.1709031908440.927@carhart.net> (raw)
Here are some notes on the 7 things where nasa.gov works if you implement
them all. I'd like to get your remarks before making a patch, though I
don't think any of them will cause any problems. There's one in decorate
and the rest are javascript.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(1) give a CSSStyleDeclaration attributes
CSSStyleDeclaration = function(){
this.element = null;
this.style = this;
this.attributes = new Array;
};
Justification:
http://code.jquery.com/jquery.js at line 6787 or thereabouts says
style.removeAttribute( "filter" );
So it is expecting that a style will have attributes.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(2) Give an iframe a contentWindow in addition to a contentDocument in
decorate.c:
// special code for frame.contentDocument.
if (t->parent->action == TAGACT_FRAME)
set_property_object(t->parent->jv,
"contentDocument",
t->jv);
if (t->parent->action == TAGACT_FRAME)
set_property_object(t->parent->jv,
"contentWindow",
cf->winobj);
Justification: the latest jquery at 6046 or thereabouts says this:
doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument
).document
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(3) Bring back the following definition for Event. I am getting this
from Chris Thatcher's DOM project. There is a link below.
Event = function(options){
// event state is kept read-only by forcing
// a new object for each event. This may not
// be appropriate in the long run and we'll
// have to decide if we simply dont adhere to
// the read-only restriction of the specification
this._bubbles = true;
this._cancelable = true;
this._cancelled = false;
this._currentTarget = null;
this._target = null;
this._eventPhase = Event.AT_TARGET;
this._timeStamp = new Date().getTime();
this._preventDefault = false;
this._stopPropogation = false;
};
Justification: This is in the env DOM implementation. Event handlers are
(often? or always?) expecting to be passed an Event object as an
argument. You can go to the source if you would like to review this piece
of code:
git clone https://github.com/thatcher/env-js.git
and then go to env-js/src/event/event.js
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(4) Apply the Event definition from (3) to the addEventHandler and
attachEvent too. So the firing of the handler code will accept an Event
object as an argument.
Inside of the eval() command , this:
a[i]();
Would be changed so that now we would say
var tempEvent = new Event;
tempEvent.type = name of the event that was passed in, like click;
a[i](tempEvent);
Justification: I just found this out from trial and error back when I was
playing with an edbrowse 3.3.1. It may be that it's just a jQuery
convention. It definitely makes a lot of handlers work correctly when you
have this.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(5) Implement childNodes.item. Pages want to be able to reference a set
of childNodes by an index. I don't know the best place to put this.
What I did so far is to define it on document,
document.childNodes.item = function (x) { return this[x]; }
Justification: This is referenced in the nasa.gov file, vendor.js. (see
esbrowse.git to deminify and get good line numbers.)
(vendor.js is minified, annoyingly. But, if you wish to play along you
can deminify it using esprima.parse followed by escodegen.generate in
succession. I bundled this up at
https://github.com/KevinCarhart/esbrowse.git)
So, at roughly 8260 in the de-minified line numbering, vendor.js contains
this line:
r = r.childNodes.item(t[n]);
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(6)
I also added childNodes.item to the default case of the createElement
switch statement. Maybe there is a better way to do this. Only
properties are there right now. Not functions also. But that's where I
put it currently:
c.childNodes.item = function (x) { return this[x]; }
Justification: Same as (5)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(7) Following on from Karl's exclusion of @ from the CSS selectors, I
added some more of these exclusions of CSS constructs that were causing a
runtime error when I was debugging nasa.
I used split as a crude form of existence check. Please change to regular
expression if you prefer. This is a proposed section from the 'certain
modifiers' comment all the way to the querySelectorAll. (In the CSS code
in startwindow.)
// certain modifiers not supported in this static view.
// @directives are not selectors.
if(sel.match(/^@/))
continue;
if (sel.substr(0,1) == '}')
{
sel = sel.substr(1,sel.length-1);
}
if (sel.split('-moz-').length > 1)
continue;
if (sel.split('-webkit-').length > 1)
continue;
if (sel.split('-ms-').length > 1)
continue;
if (sel.split(':before').length > 1)
continue;
if (sel.split(':after').length > 1)
continue;
if (sel.split(':active').length > 1)
continue;
// a:link is the same as a.
sel = sel.replace(/:link$/, "");
// :hover :visited etc are dynamic an not relevant here.
if(sel.match(/:(hover|visited|active)$/))
continue;
sel = sel.trim();
a = querySelectorAll(sel);
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This is all you have to do for nasa.gov to render!!
next reply other threads:[~2017-09-04 2:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 2:38 Kevin Carhart [this message]
2017-09-04 14:12 ` Karl Dahlke
2017-09-05 1:16 ` Kevin Carhart
2017-09-05 2:27 ` Karl Dahlke
2017-09-04 15:06 ` Karl Dahlke
2017-09-05 1:32 ` Kevin Carhart
2017-09-04 17:10 ` Karl Dahlke
2017-09-05 2:15 ` [Edbrowse-dev] contentWindow Kevin Carhart
[not found] ` <20170804223729.eklhad@comcast.net>
2017-09-05 2:58 ` Kevin Carhart
[not found] ` <20170804232757.eklhad@comcast.net>
2017-09-05 3:57 ` 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.LRH.2.03.1709031908440.927@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).