public class CSSStyleSheet extends StyleSheet
CSSStyleSheet
.Constructor and Description |
---|
CSSStyleSheet()
Creates a new empty stylesheet.
|
CSSStyleSheet(HTMLElement element,
org.w3c.dom.css.CSSStyleSheet wrapped,
String uri)
Creates a new stylesheet representing the specified CSS stylesheet.
|
CSSStyleSheet(HTMLElement element,
org.w3c.css.sac.InputSource source,
String uri)
Creates a new stylesheet representing the CSS stylesheet for the specified input source.
|
Modifier and Type | Method and Description |
---|---|
int |
addRule(String selector,
String rule)
Adds a new rule.
|
void |
deleteRule(int position)
Deletes an existing rule.
|
CSSRuleList |
getCssRules()
Returns the collection of rules defined in this style sheet.
|
String |
getHref()
Returns the URL of the stylesheet.
|
HTMLElement |
getOwnerNode()
For Firefox.
|
HTMLElement |
getOwningElement()
For Internet Explorer.
|
CSSRuleList |
getRules()
Retrieves the collection of rules defined in this style sheet.
|
String |
getUri()
Returns this stylesheet's URI (used to resolved contained @import rules).
|
org.w3c.dom.css.CSSStyleSheet |
getWrappedSheet()
Returns the wrapped stylesheet.
|
int |
insertRule(String rule,
int position)
Inserts a new rule.
|
boolean |
isActive()
Returns
true if this stylesheet is active, based on the media types it is associated with (if any). |
static CSSStyleSheet |
loadStylesheet(Window window,
HTMLElement element,
HtmlLink link,
String url)
Loads the stylesheet at the specified link or href.
|
void |
modifyIfNecessary(ComputedCSSStyleDeclaration style,
Element element)
Modifies the specified style object by adding any style rules which apply to the specified
element.
|
org.w3c.css.sac.SelectorList |
parseSelectors(org.w3c.css.sac.InputSource source)
Parses the selectors at the specified input source.
|
void |
removeRule(int position)
Deletes an existing rule.
|
static boolean |
selects(BrowserVersion browserVersion,
org.w3c.css.sac.Selector selector,
DomElement element)
Returns
true if the specified selector selects the specified element. |
static void |
validateSelectors(org.w3c.css.sac.SelectorList selectorList,
int documentMode,
DomNode domNode)
Validates the list of selectors.
|
clone, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, size
public CSSStyleSheet()
public CSSStyleSheet(HTMLElement element, org.w3c.css.sac.InputSource source, String uri)
element
- the owning nodesource
- the input source which contains the CSS stylesheet which this stylesheet host object representsuri
- this stylesheet's URI (used to resolved contained @import rules)public CSSStyleSheet(HTMLElement element, org.w3c.dom.css.CSSStyleSheet wrapped, String uri)
element
- the owning nodewrapped
- the CSS stylesheet which this stylesheet host object representsuri
- this stylesheet's URI (used to resolved contained @import rules)public org.w3c.dom.css.CSSStyleSheet getWrappedSheet()
public void modifyIfNecessary(ComputedCSSStyleDeclaration style, Element element)
style
- the style to modifyelement
- the element to which style rules must apply in order for them to be added to
the specified stylepublic static CSSStyleSheet loadStylesheet(Window window, HTMLElement element, HtmlLink link, String url)
window
- the current windowelement
- the parent DOM elementlink
- the stylesheet's link (may be null
if an url is specified)url
- the stylesheet's url (may be null
if a link is specified)public static boolean selects(BrowserVersion browserVersion, org.w3c.css.sac.Selector selector, DomElement element)
true
if the specified selector selects the specified element.browserVersion
- the browser versionselector
- the selector to testelement
- the element to testtrue
if it does apply, false
if it doesn't applypublic org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source)
source
- the source from which to retrieve the selectors to be parsedpublic HTMLElement getOwnerNode()
public HTMLElement getOwningElement()
public CSSRuleList getRules()
public CSSRuleList getCssRules()
public String getHref()
public int insertRule(String rule, int position)
rule
- the CSS ruleposition
- the position at which to insert the rulepublic void deleteRule(int position)
position
- the position of the rule to be deletedpublic int addRule(String selector, String rule)
selector
- the selector namerule
- the rulepublic void removeRule(int position)
position
- the position of the rule to be deletedpublic String getUri()
public boolean isActive()
true
if this stylesheet is active, based on the media types it is associated with (if any).true
if this stylesheet is active, based on the media types it is associated with (if any)public static void validateSelectors(org.w3c.css.sac.SelectorList selectorList, int documentMode, DomNode domNode) throws org.w3c.css.sac.CSSException
selectorList
- the selectorsdocumentMode
- see HTMLDocument.getDocumentMode()
domNode
- the dom node the query should work onorg.w3c.css.sac.CSSException
- if a selector is invalidCopyright © 2002–2017 Gargoyle Software Inc.. All rights reserved.