mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 15:22:26 +01:00
Minor cleanup
This commit is contained in:
@@ -48,15 +48,15 @@ liberator.Buffer = function () //{{{
|
|||||||
|
|
||||||
const arrayIter = liberator.util.arrayIter;
|
const arrayIter = liberator.util.arrayIter;
|
||||||
|
|
||||||
|
function Styles(name, store, serial)
|
||||||
|
{
|
||||||
/* Can't reference liberator or Components inside Styles --
|
/* Can't reference liberator or Components inside Styles --
|
||||||
* they're members of the window object, which disappear
|
* they're members of the window object, which disappear
|
||||||
* with this window.
|
* with this window.
|
||||||
*/
|
*/
|
||||||
function Styles(name, store, serial)
|
|
||||||
{
|
|
||||||
const xmlToDom = liberator.util.xmlToDom;
|
|
||||||
const sleep = liberator.sleep;
|
const sleep = liberator.sleep;
|
||||||
const storage = liberator.storage;
|
const storage = liberator.storage;
|
||||||
|
const xmlToDom = liberator.util.xmlToDom;
|
||||||
const consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
const consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
||||||
.getService(Components.interfaces.nsIConsoleService);
|
.getService(Components.interfaces.nsIConsoleService);
|
||||||
const ios = Components.classes["@mozilla.org/network/io-service;1"]
|
const ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||||
@@ -164,6 +164,7 @@ liberator.Buffer = function () //{{{
|
|||||||
let testDoc = document.implementation.createDocument(XHTML, "doc", null);
|
let testDoc = document.implementation.createDocument(XHTML, "doc", null);
|
||||||
function checkSyntax(css)
|
function checkSyntax(css)
|
||||||
{
|
{
|
||||||
|
let uri = cssUri(namespace + css);
|
||||||
let errors = [];
|
let errors = [];
|
||||||
let listener = {
|
let listener = {
|
||||||
QueryInterface: queryinterface,
|
QueryInterface: queryinterface,
|
||||||
@@ -172,7 +173,7 @@ liberator.Buffer = function () //{{{
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
message = message.QueryInterface(Components.interfaces.nsIScriptError);
|
message = message.QueryInterface(Components.interfaces.nsIScriptError);
|
||||||
if (message.sourceName.indexOf("data:text/css,") == 0)
|
if (message.sourceName == uri)
|
||||||
errors.push(message.errorMessage);
|
errors.push(message.errorMessage);
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
@@ -185,7 +186,7 @@ liberator.Buffer = function () //{{{
|
|||||||
if (testDoc.documentElement.firstChild)
|
if (testDoc.documentElement.firstChild)
|
||||||
testDoc.documentElement.removeChild(testDoc.documentElement.firstChild);
|
testDoc.documentElement.removeChild(testDoc.documentElement.firstChild);
|
||||||
testDoc.documentElement.appendChild(xmlToDom(
|
testDoc.documentElement.appendChild(xmlToDom(
|
||||||
<html><head><link type="text/css" rel="stylesheet" href={cssUri(namespace + css)}/></head></html>, testDoc));
|
<html><head><link type="text/css" rel="stylesheet" href={uri}/></head></html>, testDoc));
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -1097,9 +1098,8 @@ liberator.Buffer = function () //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let getCSS = function (style) ".hl-" + class + selectors + " { " + style.replace(/(?:!\s*important\s*)?;|(?:!\s*important\s*)?;?$/g, "!important;") + " }";
|
let getCSS = function (style) ".hl-" + class + selectors + " { " + style.replace(/(?:!\s*important\s*)?(?:;|;?$)/g, "!important;") + " }";
|
||||||
let css = getCSS(style);
|
let css = getCSS(style);
|
||||||
liberator.log("css: " + css);
|
|
||||||
|
|
||||||
if (highlight.get(key))
|
if (highlight.get(key))
|
||||||
styles.removeSheet(highlightDocs, getCSS(highlight.get(key)), true);
|
styles.removeSheet(highlightDocs, getCSS(highlight.get(key)), true);
|
||||||
|
|||||||
Reference in New Issue
Block a user