java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.css.StyleSheet
org.htmlunit.javascript.host.css.CSSStyleSheet
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
CSSStyleSheet.- Author:
- Marc Guillemot, Daniel Gredler, Ahmed Ashour, Ronald Brill, Guy Burton, Frank Danek, Carsten Steul
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealedFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty stylesheet.CSSStyleSheet(HTMLElement element, String styleSheet, String uri) Creates a new stylesheet representing the CSS stylesheet for the specified input source.CSSStyleSheet(HTMLElement element, org.htmlunit.corejs.javascript.VarScope parentScope, CssStyleSheet cssStyleSheet) Creates a new stylesheet representing the specified CSS stylesheet.CSSStyleSheet(HTMLElement element, org.htmlunit.cssparser.parser.InputSource source, String uri) Creates a new stylesheet representing the CSS stylesheet for the specified input source. -
Method Summary
Modifier and TypeMethodDescriptionintAdds a new rule.voiddeleteRule(int position) Deletes an existing rule.Returns the collection of rules defined in this style sheet.Returns the wrapped stylesheet.getRules()Retrieves the collection of rules defined in this style sheet.getUri()Returns this stylesheet's URI (used to resolved contained @import rules).intinsertRule(String rule, int position) Inserts a new rule.voidCreates a new empty stylesheet.voidremoveRule(int position) Deletes an existing rule.Methods inherited from class org.htmlunit.javascript.host.css.StyleSheet
getHref, getOwnerNodeMethods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowOrWorkerGlobalScope, getWithPreemption, has, hasInstance, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMapsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.Scriptable
get, getIds, has, hasMethods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable
get, has
-
Constructor Details
-
CSSStyleSheet
public CSSStyleSheet()Creates a new empty stylesheet. -
CSSStyleSheet
public CSSStyleSheet(HTMLElement element, org.htmlunit.cssparser.parser.InputSource source, String uri) Creates a new stylesheet representing the CSS stylesheet for the specified input source.- Parameters:
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)
-
CSSStyleSheet
Creates a new stylesheet representing the CSS stylesheet for the specified input source.- Parameters:
element- the owning nodestyleSheet- the source which contains the CSS stylesheet which this stylesheet host object representsuri- this stylesheet's URI (used to resolved contained @import rules)
-
CSSStyleSheet
public CSSStyleSheet(HTMLElement element, org.htmlunit.corejs.javascript.VarScope parentScope, CssStyleSheet cssStyleSheet) Creates a new stylesheet representing the specified CSS stylesheet.- Parameters:
element- the owning nodeparentScope- the parent scopecssStyleSheet- the CSS stylesheet which this stylesheet host object represents
-
-
Method Details
-
jsConstructor
public void jsConstructor()Creates a new empty stylesheet.- Overrides:
jsConstructorin classStyleSheet
-
getCssStyleSheet
Returns the wrapped stylesheet.- Returns:
- the wrapped stylesheet
-
getRules
Retrieves the collection of rules defined in this style sheet.- Returns:
- the collection of rules defined in this style sheet
-
getCssRules
Returns the collection of rules defined in this style sheet.- Returns:
- the collection of rules defined in this style sheet
-
insertRule
Inserts a new rule.- Parameters:
rule- the CSS ruleposition- the position at which to insert the rule- Returns:
- the position of the inserted rule
- See Also:
-
deleteRule
public void deleteRule(int position) Deletes an existing rule.- Parameters:
position- the position of the rule to be deleted- See Also:
-
addRule
Adds a new rule.- Parameters:
selector- the selector namerule- the rule- Returns:
- always return -1 as of MSDN documentation
- See Also:
-
removeRule
public void removeRule(int position) Deletes an existing rule.- Parameters:
position- the position of the rule to be deleted- See Also:
-
getUri
Returns this stylesheet's URI (used to resolved contained @import rules). For inline styles this is the page uri.- Overrides:
getUriin classStyleSheet- Returns:
- this stylesheet's URI (used to resolved contained @import rules)
-