1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 12:05:47 +01:00

Complete :sanitize and private mode overhaul.

--HG--
rename : common/content/sanitizer.js => common/modules/sanitizer.jsm
This commit is contained in:
Kris Maglione
2010-09-17 06:15:13 -04:00
parent a5213c3760
commit 152e6d5a1f
27 changed files with 1120 additions and 721 deletions

View File

@@ -52,7 +52,6 @@ const Highlights = Module("Highlight", {
return "Unknown highlight keyword: " + class_;
let style = this.highlight[key] || Highlight(key);
styles.removeSheet(true, style.selector);
if (append)
newStyle = (style.value || "").replace(/;?\s*$/, "; " + newStyle);
@@ -60,22 +59,23 @@ const Highlights = Module("Highlight", {
newStyle = null;
if (newStyle == null) {
if (style.default == null) {
delete this.highlight[style.class];
styles.removeSheet(true, style.selector);
delete this.highlight[style.class];
return null;
}
newStyle = style.default;
force = true;
}
let css = newStyle.replace(/(?:!\s*important\s*)?(?:;?\s*$|;)/g, "!important;")
.replace(";!important;", ";", "g"); // Seeming Spidermonkey bug
if (!/^\s*(?:!\s*important\s*)?;*\s*$/.test(css)) {
css = style.selector + " { " + css + " }";
if (!style.loaded || style.value != newStyle) {
styles.removeSheet(true, style.selector);
let css = newStyle.replace(/(?:!\s*important\s*)?(?:;?\s*$|;)/g, "!important;")
.replace(";!important;", ";", "g"); // Seeming Spidermonkey bug
if (!/^\s*(?:!\s*important\s*)?;*\s*$/.test(css)) {
css = style.selector + " { " + css + " }";
let error = styles.addSheet(true, "highlight:" + style.class, style.filter, css, true);
if (error)
return error;
styles.addSheet(true, "highlight:" + style.class, style.filter, css, true);
style.loaded = true;
}
}
style.value = newStyle;
this.highlight[style.class] = style;
@@ -120,9 +120,10 @@ const Highlights = Module("Highlight", {
style.selector = this.selector(style.class) + style.selector;
let old = this.highlight[style.class];
this.highlight[style.class] = style;
if (old && old.value != old.default)
style.value = old.value;
if (!old)
this.highlight[style.class] = style;
else if (old.value == old.default)
old.value = style.value;
}, this);
for (let [class_, hl] in Iterator(this.highlight))
if (hl.value == hl.default)