From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] defaultView and getComputedStyle patch
Date: Sun, 13 Aug 2017 21:42:36 -0700 [thread overview]
Message-ID: <20170713214236.kevin@carhart.net > (raw)
>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
next reply other threads:[~2017-08-14 4:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 4:42 Kevin Carhart [this message]
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
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='20170713214236.kevin@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).