From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (mailfrom) identity=mailfrom; client-ip=8.23.224.62; helo=out.smtp-auth.no-ip.com; envelope-from=kevin@carhart.net; receiver= Received: from out.smtp-auth.no-ip.com (smtp-auth.no-ip.com [8.23.224.62]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 4412877DE8 for ; Mon, 4 Sep 2017 22:29:53 -0700 (PDT) X-No-IP: carhart.net@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from carhart.net (unknown [99.52.200.227]) (Authenticated sender: carhart.net@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 31777114 for ; Mon, 4 Sep 2017 22:30:44 -0700 (PDT) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id v855UepX011373; Mon, 4 Sep 2017 22:30:40 -0700 To: Edbrowse-dev@lists.the-brannons.com From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.5.4.2 Date: Mon, 04 Sep 2017 22:30:40 -0700 Message-ID: <20170804223040.kevin@carhart.net > Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-705135 Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] [PATCH] attributes, Event, item, var s X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.24 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 05:29:53 -0000 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --nextpart-eb-705135 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>From 7efbfa49404222d6c7614385a02f9b7c8057a796 Mon Sep 17 00:00:00 2001 From: Kevin Carhart Date: Mon, 4 Sep 2017 22:19:41 -0700 Subject: [PATCH] Flesh out a few things in the DOM. Add the Event = object and pump it in to the addEventHandler and attachEvent. Turn s into a local variable in getComputedStyle to avoid collisions --- src/startwindow.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/startwindow.js b/src/startwindow.js index 9dcdd77..e246600 100644 --- a/src/startwindow.js +++ b/src/startwindow.js @@ -773,6 +773,7 @@ Document =3D function(){} CSSStyleDeclaration =3D function(){ this.element =3D null; this.style =3D this; + this.attributes =3D new Array; }; =20 CSSStyleDeclaration.prototype.getPropertyValue =3D function(p) { @@ -787,7 +788,7 @@ document.style.bgcolor =3D "white"; =20 getComputedStyle =3D function(e,pe) { // disregarding pseudoelements for now -s =3D new CSSStyleDeclaration; +var s =3D new CSSStyleDeclaration; s.element =3D e; // This is a rather inefficient use of cssApply, but it is hardly ever = called. cssApply(e, s); @@ -1122,6 +1123,23 @@ c.nodeType =3D 8; return c; } =20 +Event =3D 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 =3D true; + this._cancelable =3D true; + this._cancelled =3D false; + this._currentTarget =3D null; + this._target =3D null; + this._eventPhase =3D Event.AT_TARGET; + this._timeStamp =3D new Date().getTime(); + this._preventDefault =3D false; + this._stopPropagation =3D false; +}; + /********************************************************************* This is our addEventListener function. It is bound to window, which is ok because window has such a function @@ -1136,6 +1154,7 @@ Third arg is not used cause I don't understand it. =20 function addEventListener(ev, handler, notused) { +ev_before_changes =3D ev; ev =3D "on" + ev; var evarray =3D ev + "$$array"; // array of handlers var evorig =3D ev + "$$orig"; // original handler from html @@ -1149,7 +1168,7 @@ this[ev] =3D undefined; } this[evarray] =3D a; eval( -'this.' + ev + ' =3D function(){ var a =3D this.' + evarray + '; = if(this.' + evorig + ') this.' + evorig + '(); for(var i =3D 0; = i