Element Class
Q extended methods for DOM Elements
Item Index
Methods
addClass
-
className
Restore ability to select text in an element
Parameters:
-
className
String
Returns:
returns this, for chaining
adjustScrolling
-
element
Call this to make sure scrolling is adjusted properly after contents have changed. Some browsers, such as Safari on iOS, don't act properly unless this is called.
Parameters:
-
element
Element
computedStyle
-
[name]
Returns a snapshot of the computed style of an element.
Parameters:
-
[name]
String optionalIf provided, the value of a property is returned instead of the whole style object.
contains
-
child
Check whether this element is the given element or contains it
Parameters:
-
child
Element
Returns:
copyComputedStyle
-
src
Copies the computed style from another Element, and assigns it to this Element.
Parameters:
-
src
Element
Returns:
returns this, for chaining
hasClass
-
className
Check whether this element has a given CSS class
Parameters:
-
className
String
Returns:
isBefore
-
element
-
context
Check whether this Element comes before another one, in a certain context
Parameters:
Returns:
isOverflowed
()
Boolean
Returns whether the element's content has overflowed the element's bounds. Does not work in IE8 and below for elements with {text-overflow: ellipsis}.
Returns:
preventSelections
-
deep
-
callouts
Prevent ability to select text in an element
Q
-
toolName
Call this on an element to access tools attached to it. The tools are like "view models". this method is overridden by the tool constructor on specific elements
Parameters:
-
toolName
String
Returns:
remainingWidth
-
subpixelAccuracy
Gets the width remaining after subtracting all the siblings (except text nodes) on the same line.
Parameters:
-
subpixelAccuracy
Boolean
Returns:
Returns the remaining width, or null if element has no parent
removeClass
-
className
Remove a CSS class from the element
Parameters:
-
className
String
Returns:
returns this, for chaining
restoreSelections
-
deep
Restore ability to select text in an element
Parameters:
-
deep
Booleanwhether to restore it also on child elements
Returns:
scrollingParent
-
[skipIfNotOverflowed=false]
-
[direction="all"]
Returns the first element in the chain of parent elements which supports scrolling