issue 75 To Mozilla Format doesn't work in 1.0b

This commit is contained in:
Jason Barnabe 2012-11-26 22:25:25 -06:00
parent 5623fef058
commit e288d54049

16
edit.js
View File

@ -253,15 +253,17 @@ function showMozillaFormat() {
function toMozillaFormat() { function toMozillaFormat() {
return getSections().map(function(section) { 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; return section.code;
} }
var mf = "@-moz-document "; var propertyToCss = {"urls": "url", "urlPrefixes": "url-prefix", "domains": "domain", "regexps": "regexp"};
mf += section.meta.map(function(meta) { var cssMds = [];
// escape the meta according to css rules for (var i in propertyToCss) {
return meta[0] + "(\"" + meta[1].replace(/\\/g, "\\\\") + "\")"; cssMds = cssMds.concat(section[i].map(function(v) {
}).join(", "); return propertyToCss[i] + "(\"" + v.replace(/\\/g, "\\\\") + "\")";
return mf + " {\n" + section.code + "\n}"; }));
}
return "@-moz-document " + cssMds.join(", ") + " {\n" + section.code + "\n}";
}).join("\n\n"); }).join("\n\n");
} }