function loadUserSheet(win, style)
{
loadSheet(win, style, "USER_SHEET");
}
function loadAgentSheet(win, style)
{
loadSheet(win, style, "AGENT_SHEET");
}
function loadAuthorSheet(win, style)
{
loadSheet(win, style, "AUTHOR_SHEET");
}
function removeUserSheet(win, style)
{
removeSheet(win, style, "USER_SHEET");
}
function removeAgentSheet(win, style)
{
removeSheet(win, style, "AGENT_SHEET");
}
function removeAuthorSheet(win, style)
{
removeSheet(win, style, "AUTHOR_SHEET");
}
function loadSheet(win, style, type)
{ var uri = gIOService.newURI(getUri(style)); var windowUtils = SpecialPowers.getDOMWindowUtils(win);
windowUtils.loadSheet(uri, windowUtils[type]);
}
function removeSheet(win, style, type)
{ var uri = gIOService.newURI(getUri(style)); var windowUtils = SpecialPowers.getDOMWindowUtils(win);
windowUtils.removeSheet(uri, windowUtils[type]);
}
function loadAndRegisterUserSheet(win, style)
{
loadAndRegisterSheet(win, style, "USER_SHEET");
}
function loadAndRegisterAgentSheet(win, style)
{
loadAndRegisterSheet(win, style, "AGENT_SHEET");
}
function loadAndRegisterAuthorSheet(win, style)
{
loadAndRegisterSheet(win, style, "AUTHOR_SHEET");
}
function unregisterUserSheet(win, style)
{
unregisterSheet(win, style, "USER_SHEET");
}
function unregisterAgentSheet(win, style)
{
unregisterSheet(win, style, "AGENT_SHEET");
}
function unregisterAuthorSheet(win, style)
{
unregisterSheet(win, style, "AUTHOR_SHEET");
}
function loadAndRegisterSheet(win, style, type)
{
uri = gIOService.newURI(getUri(style));
gSSService.loadAndRegisterSheet(uri, gSSService[type]);
is(gSSService.sheetRegistered(uri, gSSService[type]), true);
}
function unregisterSheet(win, style, type)
{ var uri = gIOService.newURI(getUri(style));
gSSService.unregisterSheet(uri, gSSService[type]);
is(gSSService.sheetRegistered(uri, gSSService[type]), false);
}
function setDocSheet(win, style)
{ var subdoc = win.document; var headID = subdoc.getElementsByTagName("head")[0]; var cssNode = subdoc.createElement('style');
cssNode.type = 'text/css';
cssNode.innerHTML = style;
cssNode.id = 'docsheet';
headID.appendChild(cssNode);
}
function removeDocSheet(win)
{ var subdoc = win.document; var node = subdoc.getElementById('docsheet');
node.remove();
}
// There are 8 cases. Regular against regular, regular against important, important
// against regular, important against important. We can load style from typeA first
// then typeB or the other way around so that's 4*2=8 cases.
function testStyleVsStyle(win, typeA, typeB, results)
{
function color(res)
{
return res ? typeB.color : typeA.color;
}
// 5 user agent normal declarations
// 4 user normal declarations
// 3 author normal declarations
// 2 author important declarations
// 1 user important declarations
// 0 user agent important declarations
function run()
{ variframe = document.getElementById("iframe"); var win = iframe.contentWindow;
// Some explanation how to interpret this result table...
// in case of loading the agent style first and the user style later (AB)
// if there is an important rule in both for let's say color (ii)
// the rule specified in the agent style will lead (AB.ii == 0)
// If both rules would be just regular rules the one specified in the user style
// would lead. (AB.rr == 1). If we would load/add the rules in reverse order that
// would not change that (BA.rr == 1)
testStyleVsStyle(win, agent, user,
{AB:{rr:1, ii:0, ri:1, ir:0}, BA:{rr:1, ii:0, ri:1, ir:0}});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.