nsIStyleSheetService 编辑

Allows extensions or embeddors to add to the built-in list of user or agent style sheets.

layout/base/nsIStyleSheetService.idlScriptable Please add a summary to this article.   Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Inherits from: nsISupports

Implemented by: @mozilla.org/content/style-sheet-service;1. To create an instance, use:

var styleSheetService = Components.classes["@mozilla.org/content/style-sheet-service;1"]
                        .getService(Components.interfaces.nsIStyleSheetService);

Method overview

void loadAndRegisterSheet(in nsIURI sheetURI, in unsigned long type);
boolean sheetRegistered(in nsIURI sheetURI, in unsigned long type);
void unregisterSheet(in nsIURI sheetURI, in unsigned long type);

Constants

ConstantValueDescription
AGENT_SHEET0 
USER_SHEET1 
AUTHOR_SHEET2 

Methods

loadAndRegisterSheet()

Synchronously loads a style sheet from sheetURI and adds it to the list of user or agent style sheets.

A user sheet loaded via this API will come before userContent.css and userChrome.css in the cascade (so the rules in it will have lower precedence than rules in those sheets).

An agent sheet loaded via this API will come after ua.css in the cascade (so the rules in it will have higher precedence than rules in ua.css).

The relative ordering of two user or two agent sheets loaded via this API is undefined.

Sheets added via this API take effect on all documents, including already-loaded ones, immediately.

void loadAndRegisterSheet(
  in nsIURI sheetURI,
  in unsigned long type
);
Parameters
sheetURI
URI of the stylesheet to load and register.
type
One of the type constants.

sheetRegistered()

Check if a stylesheet has been registered

boolean sheetRegistered(
  in nsIURI sheetURI,
  in unsigned long type
);
Parameters
sheetURI
URI of the stylesheet to check.
type
One of the type constants.
Return value

Returns true if a style sheet at sheetURI has previously been added to the list of style sheets specified by type.

unregisterSheet()

Remove the style sheet at sheetURI from the list of style sheets specified by type. The removal takes effect immediately, even for already-loaded documents.

void unregisterSheet(
  in nsIURI sheetURI,
  in unsigned long type
);
Parameters
sheetURI
URI of the stylesheet to unregister.
type
One of the type constants.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:83 次

字数:5013

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文