From e288d54049e44eea30e3e865751a2bb344fee619 Mon Sep 17 00:00:00 2001 From: Jason Barnabe Date: Mon, 26 Nov 2012 22:25:25 -0600 Subject: [PATCH] issue 75 To Mozilla Format doesn't work in 1.0b --- edit.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/edit.js b/edit.js index 44f4b032..f4e6aaca 100644 --- a/edit.js +++ b/edit.js @@ -253,15 +253,17 @@ function showMozillaFormat() { function toMozillaFormat() { return getSections().map(function(section) { - if (section.meta.length == 0) { + if (section.urls.length == 0 && section.urlPrefixes.length == 0 && section.domains.length == 0 && section.regexps.length == 0) { return section.code; } - var mf = "@-moz-document "; - mf += section.meta.map(function(meta) { - // escape the meta according to css rules - return meta[0] + "(\"" + meta[1].replace(/\\/g, "\\\\") + "\")"; - }).join(", "); - return mf + " {\n" + section.code + "\n}"; + var propertyToCss = {"urls": "url", "urlPrefixes": "url-prefix", "domains": "domain", "regexps": "regexp"}; + var cssMds = []; + for (var i in propertyToCss) { + cssMds = cssMds.concat(section[i].map(function(v) { + return propertyToCss[i] + "(\"" + v.replace(/\\/g, "\\\\") + "\")"; + })); + } + return "@-moz-document " + cssMds.join(", ") + " {\n" + section.code + "\n}"; }).join("\n\n"); }