>From 55a287314b389387e9a21da90282981d6c05959b Mon Sep 17 00:00:00 2001
From: Kevin Carhart <[email protected]>
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
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev