From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (mailfrom) identity=mailfrom; client-ip=8.23.224.61; 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.61]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 0E95377DE8 for ; Sun, 13 Aug 2017 21:42:49 -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 A8C3E294 for ; Sun, 13 Aug 2017 21:42:52 -0700 (PDT) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id v7E4ga3s029765; Sun, 13 Aug 2017 21:42:42 -0700 To: Edbrowse-dev@lists.the-brannons.com From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.5.4.2 Date: Sun, 13 Aug 2017 21:42:36 -0700 Message-ID: <20170713214236.kevin@carhart.net > Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] defaultView and getComputedStyle patch 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: Mon, 14 Aug 2017 04:42:50 -0000 >>From 55a287314b389387e9a21da90282981d6c05959b Mon Sep 17 00:00:00 2001 From: Kevin Carhart Date: Sun, 13 Aug 2017 21:36:32 -0700 Subject: [PATCH] cleaning up defaultView and computedStyle, which is sitting in startwindow and is wrong. Referred to some MDN documents about what it is supposed to do. We are trying to pass the acidtests test #0 --- src/jsrt | 23 +++++++++++++++++++++++ src/startwindow.js | 22 ++++++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/jsrt b/src/jsrt index 0fad97f..000d0c4 100644 --- a/src/jsrt +++ b/src/jsrt @@ -838,6 +838,29 @@ if(document.metas[1].content != "Snoopy") fail(163); // add tests for getAttribute etc, once Meta is actually a class in startwindow.js. +test_computedstyle(); +function test_computedstyle() +{ +var el = document.createElement("p"); +el.style = {"bgcolor":"white","color":"red"}; +var lbg = document.defaultView.getComputedStyle(el,'').bgcolor +if (lbg == "white") +{ +// pass +} else { +fail(164); +} +} + + + + + + + + + + diff --git a/src/startwindow.js b/src/startwindow.js index f7d3e02..18e7da6 100644 --- a/src/startwindow.js +++ b/src/startwindow.js @@ -752,24 +752,22 @@ getPropertyValue: function (n) { } else { return this.style[n]; } - } + }, + } -getComputedStyle = function(n) { +getComputedStyle = function(e,pe) { + // disregarding pseudoelements for now obj = new CSSStyleDeclaration; - obj.element = this; - obj.style = new Array; - obj.style.push({n:obj.style[n]}); - return obj; + obj.element = e; + obj.style = e.style; + return obj.style; } -document.defaultView = function() { return this.style; } +document.defaultView = function() { return window; } -document.defaultView.getComputedStyle = function() { - obj = new CSSStyleDeclaration; - obj.element = document; - obj.style = document.style; - return obj; +document.defaultView.getComputedStyle = function(e,pe) { + return window.getComputedStyle(e,pe); } // @author Originally implemented by Yehuda Katz -- 1.8.3.2