Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: LayoutTests/fast/css/variables/cssom-read.html

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/variables/cssom-read.html
diff --git a/LayoutTests/fast/css/variables/cssom-read.html b/LayoutTests/fast/css/variables/cssom-read.html
index c646b081afcbf16b689a032660391575d6642a07..8bc54d4a21d05a51a36733a50dac02e02e3d60e0 100644
--- a/LayoutTests/fast/css/variables/cssom-read.html
+++ b/LayoutTests/fast/css/variables/cssom-read.html
@@ -9,6 +9,15 @@ if (window.testRunner) {
var pre = document.querySelector("pre");
+function outputForEach (styleVar) {
+ var varList = [];
+ styleVar.forEach(function(value, name) { varList.push([name, value]); });
+ varList.sort();
arv (Not doing code reviews) 2013/07/31 16:45:24 Why are we sorting this. The order should be deter
alancutter (OOO until 2018) 2013/08/05 09:33:49 Done.
+ for (var i in varList) {
arv (Not doing code reviews) 2013/07/31 16:45:24 forEach or c style loop
alancutter (OOO until 2018) 2013/08/05 09:33:49 Done.
+ pre.innerText += varList[i][0] + ": " + varList[i][1] + "\n";
+ }
+}
+
pre.innerText += "Count vars: " + pre.style.var.size + "\n";
pre.innerText += "\n";
@@ -17,6 +26,10 @@ pre.innerText += "a: " + pre.style.var.get("a") + "\n";
pre.innerText += "b: " + pre.style.var.get("b") + "\n";
pre.innerText += "\n";
+pre.innerText += "Enumerate vars:\n";
+outputForEach(pre.style.var);
+pre.innerText += "\n";
+
pre.innerText += "Access non existent var:\n";
pre.innerText += "z: " + pre.style.var.get("z") + "\n";
pre.innerText += "\n";
@@ -34,5 +47,9 @@ pre.innerText += "a: " + pre.style.var.get("a") + "\n";
pre.innerText += "b: " + pre.style.var.get("b") + "\n";
pre.innerText += "c: " + pre.style.var.get("c") + "\n";
pre.innerText += "d: " + pre.style.var.get("d") + "\n";
+pre.innerText += "\n";
+
+pre.innerText += "Enumerate vars:\n";
+outputForEach(pre.style.var);
</script>

Powered by Google App Engine
This is Rietveld 408576698