edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] defaultView and getComputedStyle patch
@ 2017-08-14  4:42 Kevin Carhart
  2017-08-14  6:35 ` Karl Dahlke
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Carhart @ 2017-08-14  4:42 UTC (permalink / raw)
  To: Edbrowse-dev

>From 55a287314b389387e9a21da90282981d6c05959b Mon Sep 17 00:00:00 2001
From: Kevin Carhart <kevin@carhart.net>
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);
+}
+}
+
+
+
+
+
+
+
+
+
+
 </script>
 
 </body>
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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-08-15  8:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14  4:42 [Edbrowse-dev] defaultView and getComputedStyle patch Kevin Carhart
2017-08-14  6:35 ` Karl Dahlke
2017-08-15  0:48   ` Kevin Carhart
2017-08-15  1:26     ` Karl Dahlke
2017-08-15  3:05       ` Kevin Carhart
     [not found]         ` <20170715003928.eklhad@comcast.net>
2017-08-15  5:38           ` Kevin Carhart
2017-08-15  6:43             ` Karl Dahlke
2017-08-15  7:08               ` Kevin Carhart
2017-08-15  7:33                 ` Kevin Carhart
2017-08-15  8:33                   ` Karl Dahlke

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).