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!!
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev