Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 992935 of stylesheet/utils

  • Revision slug: Mozilla/Add-ons/SDK/Low-Level_APIs/stylesheet_utils
  • Revision title: stylesheet/utils
  • Revision id: 992935
  • Created:
  • Creator: wbamberg
  • Is current revision? Yes
  • Comment

Revision Content

{{AddonSidebar}}

Experimental

Helper functions for working with stylesheets.

Globals

Functions

loadSheet(window, uri, type)

Synchronously loads a style sheet from uri and adds it to the list of additional style sheets of the document. The sheets added takes effect immediately, and only on the document of the window given.

Parameters

window : nsIDOMWindow

uri : string,
nsIURI}

type : string
The type of the sheet. It accepts the following values: "agent", "user" and "author". If not provided, the default value is "author".

removeSheet(window, uri, type)

Remove the document style sheet at sheetURI from the list of additional style sheets of the document. The removal takes effect immediately.

Parameters

window : nsIDOMWindow

uri : string,
nsIURI}

type : string
The type of the sheet. It accepts the following values: "agent", "user" and "author". If not provided, the default value is "author".

isTypeValid(type)

Verifies that the type given is a valid stylesheet's type. The values considered valid are: "agent", "user" and "author".

Parameters

type : string
The type of the sheet.

Returns

boolean : true if the type given is valid, otherwise false.

Revision Source

{{AddonSidebar}}

<div class="note">
<p>Experimental</p>
</div>

<p><span class="seoSummary">Helper functions for working with stylesheets.</span></p>

<h2 id="Globals">Globals</h2>

<h3 id="Functions">Functions</h3>

<h4 class="addon-sdk-api-name" id="loadSheet(window_uri_type)"><code>loadSheet(window, uri, type)</code></h4>

<p>Synchronously loads a style sheet from <code>uri</code> and adds it to the list of additional style sheets of the document. The sheets added takes effect immediately, and only on the document of the <code>window</code> given.</p>

<h5 id="Parameters">Parameters</h5>

<p><strong>window : nsIDOMWindow</strong></p>

<p><strong>uri : string,</strong><br />
 nsIURI}</p>

<p><strong>type : string</strong><br />
 The type of the sheet. It accepts the following values: <code>"agent"</code>, <code>"user"</code> and <code>"author"</code>. If not provided, the default value is <code>"author"</code>.</p>

<h4 class="addon-sdk-api-name" id="removeSheet(window_uri_type)"><code>removeSheet(window, uri, type)</code></h4>

<p>Remove the document style sheet at <code>sheetURI</code> from the list of additional style sheets of the document. The removal takes effect immediately.</p>

<h5 id="Parameters_2">Parameters</h5>

<p><strong>window : nsIDOMWindow</strong></p>

<p><strong>uri : string,</strong><br />
 nsIURI}</p>

<p><strong>type : string</strong><br />
 The type of the sheet. It accepts the following values: <code>"agent"</code>, <code>"user"</code> and <code>"author"</code>. If not provided, the default value is <code>"author"</code>.</p>

<h4 class="addon-sdk-api-name" id="isTypeValid(type)"><code>isTypeValid(type)</code></h4>

<p>Verifies that the <code>type</code> given is a valid stylesheet's type. The values considered valid are: <code>"agent"</code>, <code>"user"</code> and <code>"author"</code>.</p>

<h5 id="Parameters_3">Parameters</h5>

<p><strong>type : string</strong><br />
 The type of the sheet.</p>

<h5 id="Returns">Returns</h5>

<p><strong>boolean</strong> : <code>true</code> if the <code>type</code> given is valid, otherwise <code>false</code>.</p>
Revert to this revision