Node Class
The Node class provides a wrapper for manipulating DOM Nodes.
Node properties can be accessed via the set/get methods.
Use Y.one()
to retrieve Node instances.
<strong>NOTE:</strong> Node properties are accessed using the <code>set</code> and <code>get</code> methods.
Constructor
Node
-
node
Parameters:
-
node
HTMLElementthe DOM node to be mapped to the Node instance.
Index
Methods
- _get
- _getBoxStyleAsNumber
- _getFullType
- _getText
- _getType
- _hasPotentialSubscribers
- _hide
- _hide
- _hoverOutHandler
- _hoverOverHandler
- _hoverOverHandler
- _hoverOverHandler
- _ioComplete
- _isHidden
- _monitor
- _parseType
- _place
- _publish
- _show
- _show
- addClass
- addMethod static
- addTarget
- after
- all
- ancestor
- ancestors
- append
- appendChild
- appendTo
- before
- blur
- bubble
- clearData
- cloneNode
- compareTo
- contains
- create static
- create
- createCaption
- DEFAULT_GETTER static
- DEFAULT_SETTER static
- delegate
- destroy
- detach
- detachAll
- empty
- fire
- focus
- generateID
- get
- getAttribute
- getAttrs
- getCenterXY
- getComputedStyle
- getData
- getDOMNode
- getDOMNode static
- getElementsByTagName
- getEvent
- getHTML
- getMargin
- getPadding
- getStyle
- getTargets
- getX
- getXY
- getY
- guid
- hasAttribute
- hasChildNodes
- hasClass
- height
- hide
- hover
- html
- importMethod static
- inDoc
- innerHeight
- innerWidth
- inRegion
- insert
- insertBefore
- intersect
- invoke
- load
- next
- on
- once
- onceAfter
- one
- one static
- outerHeight
- outerHTML
- outerWidth
- parseType
- placeAfter
- placeBefore
- plug static
- prepend
- prependTo
- previous
- publish
- purge
- radioClass
- remove
- removeAttribute
- removeChild
- removeClass
- removeTarget
- replace
- replaceChild
- replaceClass
- reset
- resetId
- scrollIntoView
- scrubVal static
- select
- selectable
- selectText
- set
- setAttribute
- setAttrs
- setData
- setHTML
- setStyle
- setStyles
- setX
- setXY
- setY
- show
- siblings
- simulate
- simulateGesture
- submit
- subscribe deprecated
- swallowEvent
- swap
- swapXY
- test
- text
- toggle
- toggleClass
- toggleView
- toString
- transition
- unplug static
- unselectable
- unsubscribe deprecated
- unsubscribeAll deprecated
- unwrap
- val
- width
- wrap
Properties
- _instances static
- _node
- ATTRS static
- DOM_EVENTS static
- NAME static
Methods
_get
-
attr
Helper method for get.
Parameters:
-
attr
String<p>The attribute</p>
Returns:
<p>The current value of the attribute</p>
_getBoxStyleAsNumber
-
sides
-
map
Returns the combined size of the box style for the specified sides.
Parameters:
-
sides
String<p>Can be t, r, b, l or any combination of those to represent the top, right, bottom, or left sides.</p>
-
map
String<p>An object mapping mapping the "sides" param to the a CSS value to retrieve</p>
Returns:
_getFullType
-
type
Returns the fully qualified type, given a short type string. That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix.
NOTE: This method, unlike _getType, does no checking of the value passed in, and is designed to be used with the low level _publish() method, for critical path implementations which need to fast-track publish for performance reasons.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The short type to prefix</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The prefixed type, if a prefix is set, otherwise the type passed in</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
_getText
-
childNodes
Extracts text content from the passed nodes.
Parameters:
-
childNodes
Native NodeList
_getType
()
private
If the instance has a prefix attribute and the event type is not prefixed, the instance prefix is applied to the supplied type.
_hasPotentialSubscribers
-
fullType
Parameters:
-
fullType
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The fully prefixed type name</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Whether the event has potential subscribers or not</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
_hide
()
private
Overrides Y.Node._hide. Adds aui-hide to the node's cssClass
_hide
()
protected
chainable
The implementation for hiding nodes. Default is to set the hidden attribute to true and set the CSS style.display to 'none'.
_hoverOutHandler
-
event
The event handler for the "out" function that is fired for events attached via the hover method.
Parameters:
-
event
EventFacade
_hoverOverHandler
-
event
Cancels the out task, and fires the users custom "over" function for the hover method
Parameters:
-
event
EventFacade
_hoverOverHandler
-
event
The event handler for the "over" function that is fired for events attached via the hover method.
Parameters:
-
event
EventFacade
_hoverOverHandler
-
event
Cancels the over task, and fires the users custom "out" function for the hover method
Parameters:
-
event
EventFacade
_ioComplete
-
code
-
response
-
args
The default IO complete handler.
Parameters:
-
code
String<p>The response code.</p>
-
response
Object<p>The response object.</p>
-
args
Array<p>An array containing the callback and selector</p>
_isHidden
()
Boolean
private
Returns whether the node is hidden by YUI or not. The hidden status is determined by the 'hidden' attribute and the value of the 'display' CSS property.
Returns:
<p><code>true</code> if the node is hidden.</p>
_monitor
-
what
-
eventType
-
o
This is the entry point for the event monitoring system. You can monitor 'attach', 'detach', 'fire', and 'publish'. When configured, these events generate an event. click -> click_attach, click_detach, click_publish -- these can be subscribed to like other events to monitor the event system. Inividual published events can have monitoring turned on or off (publish can't be turned off before it it published) by setting the events 'monitor' config.
Parameters:
-
what
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>'attach', 'detach', 'fire', or 'publish'</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
eventType
String | CustomEvent<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The prefixed name of the event being monitored, or the CustomEvent object.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
o
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Information about the event interaction, such as fire() args, subscription category, publish config</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
_parseType
()
private
Returns an array with the detach key (if provided), and the prefixed event name from _getType Y.on('detachcategory| menu:click', fn)
_place
-
newNode
-
refNode
Places a node or html string at a specific location
_publish
-
fullType
-
etOpts
-
ceOpts
The low level event publish implementation. It expects all the massaging to have been done
outside of this method. e.g. the type
to fullType
conversion. It's designed to be a fast
path publish, which can be used by critical code paths to improve performance.
Parameters:
-
fullType
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The prefixed type of the event to publish.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
etOpts
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The EventTarget specific configuration to mix into the published event.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
ceOpts
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The publish specific configuration to mix into the published event.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The published event. If called without <code>etOpts</code> or <code>ceOpts</code>, this will be the default <code>CustomEvent</code> instance, and can be configured independently.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
_show
()
private
Overrides Y.Node._show. Removes aui-hide from the node's cssClass
_show
()
protected
chainable
The implementation for showing nodes. Default is to remove the hidden attribute and reset the CSS style.display property.
addClass
-
className
Adds a class name to the node.
Parameters:
-
className
String<p>the class name to add to the node's class attribute</p>
addMethod
-
name
-
fn
-
context
Adds methods to the Y.Node prototype, routing through scrubVal.
Parameters:
-
name
StringThe name of the method to add
-
fn
FunctionThe function that becomes the method
-
context
ObjectAn optional context to call the method with (defaults to the Node instance)
Returns:
Depends on what is returned from the DOM node.
addTarget
-
o
Registers another EventTarget as a bubble target. Bubble order is determined by the order registered. Multiple targets can be specified.
Events can only bubble if emitFacade is true.
Included in the event-custom-complex submodule.
Parameters:
-
o
EventTarget<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the target to add</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
after
-
type
-
fn
-
[context]
-
[arg*]
Subscribe to a custom event hosted by this object. The supplied callback will execute after any listeners add via the subscribe method, and after the default function, if configured for the event, has executed.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
fn
Function<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The callback to execute in response to the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[context]
Object optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Override <code>this</code> object in callback</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[arg*]
Any optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>0..n additional arguments to supply to the subscriber</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>A subscription handle capable of detaching the subscription</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
all
-
selector
Retrieves a NodeList based on the given CSS selector.
Parameters:
-
selector
String<p>The CSS selector to test against.</p>
Returns:
<p>A NodeList instance for the matching HTMLCollection/Array.</p>
ancestor
-
fn
-
testSelf
-
stopFn
Returns the nearest ancestor that passes the test applied by supplied boolean method.
Parameters:
-
fn
String | Function<p>A selector string or boolean method for testing elements. If a function is used, it receives the current node being tested as the only argument. If fn is not passed as an argument, the parent node will be returned.</p>
-
testSelf
Boolean<p>optional Whether or not to include the element in the scan</p>
-
stopFn
String | Function<p>optional A selector string or boolean method to indicate when the search should stop. The search bails when the function returns true or the selector matches. If a function is used, it receives the current node being tested as the only argument.</p>
Returns:
<p>The matching Node instance or null if not found</p>
ancestors
-
fn
-
testSelf
Returns the ancestors that pass the test applied by supplied boolean method.
Parameters:
-
fn
String | Function<p>A selector string or boolean method for testing elements.</p>
-
testSelf
Boolean<p>optional Whether or not to include the element in the scan If a function is used, it receives the current node being tested as the only argument.</p>
Returns:
<p>A NodeList instance containing the matching elements</p>
append
-
content
Inserts the content as the lastChild of the node.
Parameters:
-
content
String | Node | HTMLElement<p>The content to insert. Use <a href="../classes/Escape.html#method_html"><code>Y.Escape.html()</code></a> to escape html content.</p>
appendChild
-
node
Parameters:
-
node
String | HTMLElement | Node<p>Node to be appended. Use <a href="../classes/Escape.html#method_html"><code>Y.Escape.html()</code></a> to escape html content.</p>
Returns:
<p>The appended node</p>
appendTo
-
node
Appends the node to the given node.
Parameters:
-
node
Node | HTMLElement | String<p>The node to append to. If <code>node</code> is a string it will be considered as a css selector and only the first matching node will be used.</p>
Example:
// appendTo returns the node that has been created beforehand
Y.Node.create('<p></p>').appendTo('body').set('text', 'hello world!');
before
()
Executes the callback before a DOM event, custom event or method. If the first argument is a function, it is assumed the target is a method. For DOM and custom events, this is an alias for Y.on.
For DOM and custom events: type, callback, context, 0-n arguments
For methods: callback, object (method host), methodName, context, 0-n arguments
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>detach handle</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
blur
()
chainable
Passes through to DOM method.
bubble
-
evt
Propagate an event. Requires the event-custom-complex module.
Parameters:
-
evt
CustomEvent<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the custom event to propagate</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the aggregated return value from Event.Custom.fire</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
clearData
-
name
Clears internally stored data.
Parameters:
-
name
String<p>The name of the field to clear. If no name is given, all data is cleared.</p>
cloneNode
-
deep
Passes through to DOM method.
Parameters:
-
deep
Boolean<p>Whether or not to perform a deep clone, which includes subtree and attributes</p>
Returns:
<p>The clone</p>
compareTo
-
refNode
Compares nodes to determine if they match. Node instances can be compared to each other and/or HTMLElements.
Parameters:
-
refNode
HTMLElement | Node<p>The reference node to compare to the node.</p>
Returns:
<p>True if the nodes match, false if they do not.</p>
contains
-
needle
Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
Parameters:
-
needle
Node | HTMLElement<p>The possible node or descendent</p>
Returns:
<p>Whether or not this node is the needle its ancestor</p>
create
-
html
-
doc
Returns a new dom node using the provided markup string.
Parameters:
-
html
StringThe markup used to create the element. Use <a href="../classes/Escape.html#method_html">
Y.Escape.html()
</a> to escape html content. -
doc
HTMLDocumentAn optional document context
Returns:
A Node instance bound to a DOM node or fragment
create
-
html
-
doc
Creates a new Node using the provided markup string.
Parameters:
-
html
String<p>The markup used to create the element. Use <a href="../classes/Escape.html#method_html"><code>Y.Escape.html()</code></a> to escape html content.</p>
-
doc
HTMLDocument<p>An optional document context</p>
Returns:
<p>A Node instance bound to a DOM node or fragment</p>
createCaption
()
chainable
Passes through to DOM method. Only valid on TABLE elements
DEFAULT_GETTER
-
name
The default getter for DOM properties Called with instance context (this === the Node instance)
Parameters:
-
name
StringThe attribute/property to look up
Returns:
The current value
DEFAULT_SETTER
-
name
-
val
The default setter for DOM properties Called with instance context (this === the Node instance)
Parameters:
-
name
StringThe attribute/property being set
-
val
AnyThe value to be set
Returns:
The value
delegate
-
type
-
fn
-
spec
-
context
-
args
<p>Sets up a delegation listener for an event occurring inside the Node. The delegated event will be verified against a supplied selector or filtering function to test if the event references at least one node that should trigger the subscription callback.</p>
<p>Selector string filters will trigger the callback if the event originated from a node that matches it or is contained in a node that matches it. Function filters are called for each Node up the parent axis to the subscribing container node, and receive at each level the Node and the event object. The function should return true (or a truthy value) if that Node should trigger the subscription callback. Note, it is possible for filters to match multiple Nodes for a single event. In this case, the delegate callback will be executed for each matching Node.</p>
<p>For each matching Node, the callback will be executed with its 'this' object set to the Node matched by the filter (unless a specific context was provided during subscription), and the provided event's <code>currentTarget</code> will also be set to the matching Node. The containing Node from which the subscription was originally made can be referenced as <code>e.container</code>.
Parameters:
-
type
String<p>the event type to delegate</p>
-
fn
Function<p>the callback function to execute. This function will be provided the event object for the delegated event.</p>
-
spec
String | Function<p>a selector that must match the target of the event or a function to test target and its parents for a match</p>
-
context
Object<p>optional argument that specifies what 'this' refers to.</p>
-
args
Any multiple<p>0..n additional arguments to pass on to the callback function. These arguments will be added after the event object.</p>
Returns:
<p>the detach handle</p>
destroy
-
recursivePurge
Nulls internal node references, removes any plugins and event listeners. Note that destroy() will not remove the node from its parent or from the DOM. For that functionality, call remove(true).
Parameters:
-
recursivePurge
Boolean<p>(optional) Whether or not to remove listeners from the node's subtree (default is false)</p>
detach
-
type
-
fn
-
context
Detach one or more listeners the from the specified event
Parameters:
-
type
String | Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Either the handle to the subscriber or the type of event. If the type is not specified, it will attempt to remove the listener from all hosted events.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
fn
Function<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The subscribed function to unsubscribe, if not supplied, all subscribers will be removed.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
context
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The custom object passed to subscribe. This is optional, but if supplied will be used to disambiguate multiple listeners that are the same (e.g., you subscribe many object using a function that lives on the prototype)</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the host</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
detachAll
-
type
Removes all listeners from the specified event. If the event type is not specified, all listeners from all hosted custom events will be removed.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The type, or name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
empty
()
chainable
Removes and destroys all of the nodes within the node.
fire
-
type
-
arguments
Fire a custom event by name. The callback functions will be executed from the context specified when the event was created, and with the following parameters.
The first argument is the event type, and any additional arguments are passed to the listeners as parameters. If the first of these is an object literal, and the event is configured to emit an event facade, that object is mixed into the event facade and the facade is provided in place of the original object.
If the custom event object hasn't been created, then the event hasn't been published and it has no subscribers. For performance sake, we immediate exit in this case. This means the event won't bubble, so if the intention is that a bubble target be notified, the event must be published on this object first.
Parameters:
-
type
String | Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The type of the event, or an object that contains a 'type' property.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
arguments
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>an arbitrary set of parameters to pass to the handler. If the first of these is an object literal and the event is configured to emit an event facade, the event facade will replace that parameter after the properties the object literal contains are copied to the event facade.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>True if the whole lifecycle of the event went through, false if at any point the event propagation was halted.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
focus
()
chainable
Passes through to DOM method.
generateID
()
String
Applies a unique ID to the node if none exists
Returns:
<p>The existing or generated ID</p>
get
-
attr
Returns an attribute value on the Node instance.
Unless pre-configured (via Node.ATTRS
), get hands
off to the underlying DOM node. Only valid
attributes/properties for the node will be queried.
Parameters:
-
attr
String<p>The attribute</p>
Returns:
<p>The current value of the attribute</p>
getAttribute
-
name
Allows getting attributes on DOM nodes, normalizing in some cases. This passes through to the DOM node, allowing for custom attributes.
Parameters:
-
name
String<p>The attribute name</p>
Returns:
<p>The attribute value</p>
getAttrs
-
attrs
Returns an object containing the values for the requested attributes.
Parameters:
-
attrs
Array<p>an array of attributes to get values</p>
Returns:
<p>An object with attribute name/value pairs.</p>
getCenterXY
()
Array
Gets the current center position of the node in page coordinates.
Returns:
<p>The XY position of the node</p>
getComputedStyle
-
attr
Returns the computed value for the given style property. Use camelCase (e.g. 'backgroundColor') for multi-word properties.
Parameters:
-
attr
String<p>The style attribute to retrieve.</p>
Returns:
<p>The computed value of the style property for the element.</p>
getData
-
name
Retrieves arbitrary data stored on a Node instance. If no data is associated with the Node, it will attempt to retrieve a value from the corresponding HTML data attribute. (e.g. node.getData('foo') will check node.getAttribute('data-foo')).
Parameters:
-
name
String<p>Optional name of the data field to retrieve. If no name is given, all data is returned.</p>
Returns:
<p>Whatever is stored at the given field, or an object hash of all fields.</p>
getDOMNode
()
HTMLElement
Returns the DOM node bound to the Node instance
Returns:
getDOMNode
-
node
Retrieves the DOM node bound to a Node instance
Parameters:
-
node
Node | HTMLElementThe Node instance or an HTMLElement
Returns:
The DOM node bound to the Node instance. If a DOM node is passed as the node argument, it is simply returned.
getElementsByTagName
-
tagName
Passes through to DOM method.
Parameters:
-
tagName
String<p>The tagName to collect</p>
Returns:
<p>A NodeList representing the HTMLCollection</p>
getEvent
-
type
-
prefixed
Returns the custom event of the provided type has been created, a falsy value otherwise
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the type, or name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
prefixed
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>if true, the type is prefixed already</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the custom event or null</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
getHTML
()
String
Returns the node's current html content (e.g. innerHTML)
Returns:
<p>The html content</p>
getMargin
-
sides
Returns the combined size of the margin for the specified sides.
Parameters:
-
sides
String<p>Can be t, r, b, l or any combination of those to represent the top, right, bottom, or left sides.</p>
Returns:
getPadding
-
sides
Returns the combined width of the border for the specified sides.
Parameters:
-
sides
String<p>Can be t, r, b, l or any combination of those to represent the top, right, bottom, or left sides.</p>
Returns:
getStyle
-
attr
Returns the style's current value. Use camelCase (e.g. 'backgroundColor') for multi-word properties.
Parameters:
-
attr
String<p>The style attribute to retrieve.</p>
Returns:
<p>The current value of the style property for the element.</p>
getTargets
()
Returns an array of bubble targets for this object.
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>EventTarget[]</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
getX
()
Number
Gets the current position of the node in page coordinates.
Returns:
<p>The X position of the node</p>
getXY
()
Array
Gets the current position of the node in page coordinates.
Returns:
<p>The XY position of the node</p>
getY
()
Number
Gets the current position of the node in page coordinates.
Returns:
<p>The Y position of the node</p>
guid
()
String
Sets the id of the Node instance if the object does not have one. The generated id is based on a guid created by the stamp method.
Returns:
<p>The current id of the node</p>
hasAttribute
-
attribute
Passes through to DOM method.
Parameters:
-
attribute
String<p>The attribute to test for</p>
Returns:
<p>Whether or not the attribute is present</p>
hasChildNodes
()
Boolean
Passes through to DOM method.
Returns:
<p>Whether or not the node has any childNodes</p>
hasClass
-
className
Determines whether the node has the given className.
Parameters:
-
className
String<p>the class name to search for</p>
Returns:
<p>Whether or not the node has the specified class</p>
height
()
Number
Returns the height of the content, not including the padding, border or margin. If a height is passed, the node's overall height is set to that size.
Example:
var node = A.one('#nodeId');
node.height(); //return content height
node.height(100); // sets box height
Returns:
hide
-
name
-
config
-
callback
Hides the node. If the "transition" module is loaded, hide optionally animates the hiding of the node using either the default transition effect ('fadeOut'), or the given named effect.
Parameters:
-
name
String<p>A named Transition effect to use as the show effect.</p>
-
config
Object<p>Options to use with the transition.</p>
-
callback
Function<p>An optional function to run after the transition completes.</p>
hover
-
overFn
-
outFn
Creates a hover interaction.
Parameters:
-
overFn
String -
outFn
String
Returns:
<p>The current Node instance</p>
html
-
value
Gets or sets the HTML contents of the node. If the value
is passed it's
set the content of the element, otherwise it works as a getter for the
current content.
Example:
var node = A.one('#nodeId');
node.html('Setting new HTML');
// Alert the value of the current content
alert( node.html() );
Parameters:
-
value
String<p>A string of html to set as the content of the node instance.</p>
importMethod
-
host
-
name
-
altName
-
context
Imports utility methods to be added as Y.Node methods.
Parameters:
-
host
ObjectThe object that contains the method to import.
-
name
StringThe name of the method to import
-
altName
StringAn optional name to use in place of the host name
-
context
ObjectAn optional context to call the method with
inDoc
-
doc
Determines whether the node is appended to the document.
Parameters:
-
doc
Node | HTMLElement<p>optional An optional document to check against. Defaults to current document.</p>
Returns:
<p>Whether or not this node is appended to the document.</p>
innerHeight
()
Number
Returns the size of the box from inside of the border, which is offsetHeight plus the padding on the top and bottom.
Example:
var node = A.one('#nodeId');
node.innerHeight();
Returns:
innerWidth
()
Number
Returns the size of the box from inside of the border, which is the
offsetWidth
plus the padding on the left and right.
Example:
var node = A.one('#nodeId');
node.innerWidth();
Returns:
inRegion
-
node2
-
all
-
altRegion
Determines whether or not the node is within the given region.
Parameters:
-
node2
Node | Object<p>The node or region to compare with.</p>
-
all
Boolean<p>Whether or not all of the node must be in the region.</p>
-
altRegion
Object<p>An alternate region to use (rather than this node's).</p>
Returns:
<p>True if in region, false if not.</p>
insert
-
content
-
where
Inserts the content before the reference node.
Parameters:
-
content
String | Node | HTMLElement | NodeList | HTMLCollection<p>The content to insert. Use <a href="../classes/Escape.html#method_html"><code>Y.Escape.html()</code></a> to escape html content.</p>
-
where
Int | Node | HTMLElement | String<p>The position to insert at. Possible "where" arguments <dl> <dt>Y.Node</dt> <dd>The Node to insert before</dd> <dt>HTMLElement</dt> <dd>The element to insert before</dd> <dt>Int</dt> <dd>The index of the child element to insert before</dd> <dt>"replace"</dt> <dd>Replaces the existing HTML</dd> <dt>"before"</dt> <dd>Inserts before the existing HTML</dd> <dt>"before"</dt> <dd>Inserts content before the node</dd> <dt>"after"</dt> <dd>Inserts content after the node</dd> </dl></p>
intersect
-
node2
-
altRegion
Compares the intersection of the node with another node or region
Parameters:
-
node2
Node | Object<p>The node or region to compare with.</p>
-
altRegion
Object<p>An alternate region to use (rather than this node's).</p>
Returns:
<p>An object representing the intersection of the regions.</p>
invoke
-
method
-
[args*]
Invokes a method on the Node instance
Parameters:
-
method
String<p>The name of the method to invoke</p>
-
[args*]
Any optional<p>Arguments to invoke the method with.</p>
Returns:
<p>Whatever the underly method returns. DOM Nodes and Collections return values are converted to Node/NodeList instances.</p>
load
-
url
-
selector
-
callback
Loads content from the given url and replaces the Node's existing content with the remote content.
Parameters:
-
url
String<p>The URL to load via XMLHttpRequest.</p>
-
selector
String<p>An optional selector representing a subset of an HTML document to load.</p>
-
callback
Function<p>An optional function to run after the content has been loaded.</p>
next
-
fn
-
[all]
Returns the next matching sibling. Returns the nearest element node sibling if no method provided.
Parameters:
-
fn
String | Function<p>A selector or boolean method for testing elements. If a function is used, it receives the current node being tested as the only argument.</p>
-
[all]
Boolean optional<p>Whether text nodes as well as element nodes should be returned, or just element nodes will be returned(default)</p>
Returns:
<p>Node instance or null if not found</p>
on
-
type
-
fn
-
[context]
-
[arg*]
Subscribe a callback function to execute in response to a DOM event or custom event.
Most DOM events are associated with a preventable default behavior such as
link clicks navigating to a new page. Callbacks are passed a DOMEventFacade
object as their first argument (usually called e
) that can be used to
prevent this default behavior with e.preventDefault()
. See the
DOMEventFacade
API for all available properties and methods on the object.
If the event name passed as the first parameter is not a whitelisted DOM event,
it will be treated as a custom event subscriptions, allowing
node.fire('customEventName')
later in the code. Refer to the Event user guide
for the full DOM event whitelist.
By default, the this
object in the callback will refer to the subscribed
Node
.
Returning false
from a callback is supported as an alternative to calling
e.preventDefault(); e.stopPropagation();
. However, it is recommended to use
the event methods.
Parameters:
-
type
String<p>The name of the event</p>
-
fn
Function<p>The callback to execute in response to the event</p>
-
[context]
Object optional<p>Override <code>this</code> object in callback</p>
-
[arg*]
Any optional<p>0..n additional arguments to supply to the subscriber</p>
Returns:
<p>A subscription handle capable of detaching that subscription</p>
Example:
Y.one("#my-form").on("submit", function (e) {
e.preventDefault();
// proceed with ajax form submission instead...
});
once
-
type
-
fn
-
[context]
-
[arg*]
Listen to a custom event hosted by this object one time. This is the equivalent to <code>on</code> except the listener is immediatelly detached when it is executed.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
fn
Function<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The callback to execute in response to the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[context]
Object optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Override <code>this</code> object in callback</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[arg*]
Any optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>0..n additional arguments to supply to the subscriber</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>A subscription handle capable of detaching the subscription</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
onceAfter
-
type
-
fn
-
[context]
-
[arg*]
Listen to a custom event hosted by this object one time. This is the equivalent to <code>after</code> except the listener is immediatelly detached when it is executed.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
fn
Function<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The callback to execute in response to the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[context]
Object optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Override <code>this</code> object in callback</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[arg*]
Any optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>0..n additional arguments to supply to the subscriber</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>A subscription handle capable of detaching that subscription</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
one
-
selector
Retrieves a single Node instance, the first element matching the given CSS selector. Returns null if no match found.
Parameters:
-
selector
String<p>The CSS selector to test against.</p>
Returns:
<p>A Node instance for the matching HTMLElement or null if no match found.</p>
one
-
node
Returns a single Node instance bound to the node or the first element matching the given selector. Returns null if no match found. <strong>Note:</strong> For chaining purposes you may want to use <code>Y.all</code>, which returns a NodeList when no match is found.
Parameters:
-
node
String | HTMLElementa node or Selector
Returns:
a Node instance or null if no match found.
outerHeight
()
Number
Returns the outer height of the box including the border, if true is passed as the first argument, the margin is included.
Example:
var node = A.one('#nodeId');
node.outerHeight();
node.outerHeight(true); // includes margin
Returns:
outerHTML
()
String
Gets the outerHTML of a node, which islike innerHTML, except that it actually contains the HTML of the node itself.
Returns:
<p>The outerHTML of the given element.</p>
outerWidth
()
Number
Returns the outer width of the box including the border, if true is passed as the first argument, the margin is included.
Example:
var node = A.one('#nodeId');
node.outerWidth();
node.outerWidth(true); // includes margin
Returns:
parseType
-
type
-
[pre]
Takes the type parameter passed to 'on' and parses out the various pieces that could be included in the type. If the event type is passed without a prefix, it will be expanded to include the prefix one is supplied or the event target is configured with a default prefix.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the type</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[pre]
String optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The prefix. Defaults to this._yuievt.config.prefix</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>an array containing:</p> <ul> <li>the detach category, if supplied,</li> <li>the prefixed event type,</li> <li>whether or not this is an after listener,</li> <li>the supplied event type</li> </ul></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
placeAfter
-
newNode
Inserts a newNode
after the node instance (i.e., as the next sibling).
If the reference node has no parent, then does nothing.
Example:
var titleNode = A.one('#titleNode');
var descriptionNode = A.one('#descriptionNode');
// the description is usually shown after the title
titleNode.placeAfter(descriptionNode);
Parameters:
-
newNode
Node<p>Node to insert.</p>
placeBefore
-
newNode
Inserts a newNode
before the node instance (i.e., as the previous
sibling). If the reference node has no parent, then does nothing.
Example:
var descriptionNode = A.one('#descriptionNode');
var titleNode = A.one('#titleNode');
// the title is usually shown before the description
descriptionNode.placeBefore(titleNode);
Parameters:
-
newNode
Node<p>Node to insert.</p>
plug
-
plugin
-
config
Registers plugins to be instantiated at the class level (plugins which should be plugged into every instance of Node by default).
Parameters:
-
plugin
Function | ArrayEither the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
-
config
Object(Optional) If plugin is the plugin class, the configuration for the plugin
prepend
-
content
Inserts the content as the firstChild of the node.
Parameters:
-
content
String | Node | HTMLElement<p>The content to insert. Use <a href="../classes/Escape.html#method_html"><code>Y.Escape.html()</code></a> to escape html content.</p>
prependTo
-
selector
Inserts the node instance to the begining of the selector
node (i.e.,
insert before the firstChild
of the selector
).
Example:
var node = A.one('#nodeId');
node.prependTo('body');
Parameters:
-
selector
Node | String<p>A selector, element, HTML string, Node</p>
previous
-
fn
-
[all]
Returns the previous matching sibling. Returns the nearest element node sibling if no method provided.
Parameters:
-
fn
String | Function<p>A selector or boolean method for testing elements. If a function is used, it receives the current node being tested as the only argument.</p>
-
[all]
Boolean optional<p>Whether text nodes as well as element nodes should be returned, or just element nodes will be returned(default)</p>
Returns:
<p>Node instance or null if not found</p>
publish
-
type
-
opts
Creates a new custom event of the specified type. If a custom event by that name already exists, it will not be re-created. In either case the custom event is returned.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the type, or name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
opts
Object<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>optional config params. Valid properties are:</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[broadcast=false]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>whether or not the YUI instance and YUI global are notified when the event is fired.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[bubbles=true]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>Whether or not this event bubbles. Events can only bubble if <code>emitFacade</code> is true.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[context=this]
Object optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the default execution context for the listeners.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[defaultFn]
Function optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the default function to execute when this event fires if preventDefault was not called.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[emitFacade=false]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>whether or not this event emits a facade.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[prefix]
String optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the prefix for this targets events, e.g., 'menu' in 'menu:click'.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[fireOnce=false]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>if an event is configured to fire once, new subscribers after the fire will be notified immediately.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[async=false]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>fireOnce event listeners will fire synchronously if the event has already fired unless <code>async</code> is <code>true</code>.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[preventable=true]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>whether or not <code>preventDefault()</code> has an effect.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[preventedFn]
Function optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>a function that is executed when <code>preventDefault()</code> is called.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[queuable=false]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>whether or not this event can be queued during bubbling.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[silent]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>if silent is true, debug messages are not provided for this event.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[stoppedFn]
Function optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>a function that is executed when stopPropagation is called.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[monitored]
Boolean optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>specifies whether or not this event should send notifications about when the event has been attached, detached, or published.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
[type]
String optional<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the event type (valid option if not provided as the first parameter to publish).</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
-
Returns:
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the custom event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
purge
-
recurse
-
type
Removes event listeners from the node and (optionally) its subtree
Parameters:
-
recurse
Boolean<p>(optional) Whether or not to remove listeners from the node's subtree</p>
-
type
String<p>(optional) Only remove listeners of the specified type</p>
radioClass
-
cssClass
Adds one or more CSS classes to an element and remove the class(es) from the siblings of the element.
Parameters:
-
cssClass
String
remove
-
destroy
Removes the node from its parent. Shortcut for myNode.get('parentNode').removeChild(myNode);
Parameters:
-
destroy
Boolean<p>whether or not to call destroy() on the node after removal.</p>
removeAttribute
-
attribute
Passes through to DOM method.
Parameters:
-
attribute
String<p>The attribute to be removed</p>
removeChild
-
node
Passes through to DOM method.
Parameters:
-
node
HTMLElement | Node<p>Node to be removed</p>
Returns:
<p>The removed node</p>
removeClass
-
className
Removes a class name from the node.
Parameters:
-
className
String<p>the class name to remove from the node's class attribute</p>
removeTarget
-
o
Removes a bubble target
Parameters:
-
o
EventTarget<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>the target to remove</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
replace
-
newNode
Replace the node with the other node. This is a DOM update only and does not change the node bound to the Node instance. Shortcut for myNode.get('parentNode').replaceChild(newNode, myNode);
Parameters:
-
newNode
Node | HTMLElement<p>Node to be inserted</p>
replaceClass
-
oldClassName
-
newClassName
Replace a class with another class on the node. If no oldClassName is present, the newClassName is simply added.
Parameters:
-
oldClassName
String<p>the class name to be replaced</p>
-
newClassName
String<p>the class name that will be replacing the old class name</p>
reset
()
chainable
Passes through to DOM method. Only valid on FORM elements
resetId
-
prefix
Generates an unique identifier and reset the id attribute of the node instance using the new value. Invokes the guid.
Parameters:
-
prefix
String<p>Optional prefix for the guid.</p>
scrollIntoView
()
chainable
Passes through to DOM method.
scrubVal
-
node
Checks Node return values and wraps DOM Nodes as Y.Node instances and DOM Collections / Arrays as Y.NodeList instances. Other return values just pass thru. If undefined is returned (e.g. no return) then the Node instance is returned for chainability.
Parameters:
-
node
HTMLElement | HTMLElement | NodeThe Node instance or an HTMLElement
select
()
chainable
Passes through to DOM method.
selectable
-
noRecurse
Enables text selection for this element (normalized across browsers).
Parameters:
-
noRecurse
Object
selectText
-
start
-
end
Selects a substring of text inside of the input element.
set
-
attr
-
val
Sets an attribute on the Node instance. Unless pre-configured (via Node.ATTRS), set hands off to the underlying DOM node. Only valid attributes/properties for the node will be set. To set custom attributes use setAttribute.
Parameters:
-
attr
String<p>The attribute to be set.</p>
-
val
Any<p>The value to set the attribute to.</p>
setAttribute
-
name
-
value
Allows setting attributes on DOM nodes, normalizing in some cases. This passes through to the DOM node, allowing for custom attributes.
Parameters:
-
name
String<p>The attribute name</p>
-
value
String<p>The value to set</p>
setAttrs
-
attrMap
Sets multiple attributes.
Parameters:
-
attrMap
Object<p>an object of name/value pairs to set</p>
setData
-
name
-
val
Stores arbitrary data on a Node instance. This is not stored with the DOM node.
Parameters:
-
name
String<p>The name of the field to set. If no val is given, name is treated as the data and overrides any existing data.</p>
-
val
Any<p>The value to be assigned to the field.</p>
setHTML
-
content
Replaces the node's current html content with the content provided.
Note that this passes to innerHTML and is not escaped.
Use <a href="../classes/Escape.html#method_html">Y.Escape.html()
</a>
to escape html content or set('text')
to add as text.
setStyle
-
attr
-
val
Sets a style property of the node. Use camelCase (e.g. 'backgroundColor') for multi-word properties.
Parameters:
-
attr
String<p>The style attribute to set.</p>
-
val
String | Number<p>The value.</p>
setStyles
-
hash
Sets multiple style properties on the node. Use camelCase (e.g. 'backgroundColor') for multi-word properties.
Parameters:
-
hash
Object<p>An object literal of property:value pairs.</p>
setX
-
x
Set the position of the node in page coordinates, regardless of how the node is positioned.
Parameters:
-
x
Number<p>X value for new position (coordinates are page-based)</p>
setXY
-
xy
Set the position of the node in page coordinates, regardless of how the node is positioned.
Parameters:
-
xy
Array<p>Contains X & Y values for new position (coordinates are page-based)</p>
setY
-
y
Set the position of the node in page coordinates, regardless of how the node is positioned.
Parameters:
-
y
Number<p>Y value for new position (coordinates are page-based)</p>
show
-
name
-
config
-
callback
Makes the node visible. If the "transition" module is loaded, show optionally animates the showing of the node using either the default transition effect ('fadeIn'), or the given named effect.
Parameters:
-
name
String<p>A named Transition effect to use as the show effect.</p>
-
config
Object<p>Options to use with the transition.</p>
-
callback
Function<p>An optional function to run after the transition completes.</p>
siblings
-
fn
Returns all matching siblings. Returns all siblings if no method provided.
Parameters:
-
fn
String | Function<p>A selector or boolean method for testing elements. If a function is used, it receives the current node being tested as the only argument.</p>
Returns:
<p>NodeList instance bound to found siblings</p>
simulate
-
type
-
options
Simulates an event on the node.
Parameters:
-
type
String<p>The type of event (i.e., "click").</p>
-
options
Object<p>(Optional) Extra options to copy onto the event object.</p>
simulateGesture
-
name
-
[options]
-
[cb]
Simulates the higher user level gesture of the given name on this node.
This method generates a set of low level touch events(Apple specific gesture
events as well for the iOS platforms) asynchronously. Note that gesture
simulation is relying on Y.Event.simulate()
method to generate
the touch events under the hood. The Y.Event.simulate()
method
itself is a synchronous method.
Supported gestures are tap
, doubletap
, press
, move
, flick
, pinch
and rotate
.
The pinch
gesture is used to simulate the pinching and spreading of two
fingers. During a pinch simulation, rotation is also possible. Essentially
pinch
and rotate
simulations share the same base implementation to allow
both pinching and rotation at the same time. The only difference is pinch
requires start
and end
option properties while rotate
requires rotation
option property.
The pinch
and rotate
gestures can be described as placing 2 fingers along a
circle. Pinching and spreading can be described by start and end circles while
rotation occurs on a single circle. If the radius of the start circle is greater
than the end circle, the gesture becomes a pinch, otherwise it is a spread spread.
Parameters:
-
name
String<p>The name of the supported gesture to simulate. The supported gesture name is one of "tap", "doubletap", "press", "move", "flick", "pinch" and "rotate".</p>
-
[options]
Object optional<p>Extra options used to define the gesture behavior:</p> <pre><code> Valid options properties for the
tap
gesture:</code></pre>-
[point] (Optional) Indicates the [x,y]
Array optional<p>coordinates where the tap should be simulated. Default is the center of the node element.</p>
-
[hold=10]
Number optional<p>(Optional) The hold time in milliseconds. This is the time between <code>touchstart</code> and <code>touchend</code> event generation.</p>
-
[times=1]
Number optional<p>(Optional) Indicates the number of taps.</p>
-
[delay=10]
Number optional<p>(Optional) The number of milliseconds before the next tap simulation happens. This is valid only when <code>times</code> is more than 1.</p> <pre><code> Valid options properties for the
doubletap
gesture:</code></pre> -
[point] (Optional) Indicates the [x,y]
Array optional<p>coordinates where the doubletap should be simulated. Default is the center of the node element.</p> <pre><code> Valid options properties for the
press
gesture:</code></pre> -
[point] (Optional) Indicates the [x,y]
Array optional<p>coordinates where the press should be simulated. Default is the center of the node element.</p>
-
[hold=3000]
Number optional<p>(Optional) The hold time in milliseconds. This is the time between <code>touchstart</code> and <code>touchend</code> event generation. Default is 3000ms (3 seconds).</p> <pre><code> Valid options properties for the
move
gesture:</code></pre> -
[path]
Object optional<p>(Optional) Indicates the path of the finger movement. It's an object with three optional properties: <code>point</code>, <code>xdist</code> and <code>ydist</code>.</p>
-
[point]
Array optionalA starting point of the gesture. Default is the center of the node element. -
[xdist=200]
Number optionalA distance to move in pixels along the X axis. A negative distance value indicates moving left. -
[ydist=0]
Number optionalA distance to move in pixels along the Y axis. A negative distance value indicates moving up.
-
-
[duration=1000]
Number optional<p>(Optional) The duration of the gesture in milliseconds.</p> <pre><code> Valid options properties for the
flick
gesture:</code></pre> -
[point] (Optional) Indicates the [x, y]
Array optional<p>coordinates where the flick should be simulated. Default is the center of the node element.</p>
-
[axis='x']
String optional<p>(Optional) Valid values are either "x" or "y". Indicates axis to move along. The flick can move to one of 4 directions(left, right, up and down).</p>
-
[distance=200]
Number optional<p>(Optional) Distance to move in pixels</p>
-
[duration=1000]
Number optional<p>(Optional) The duration of the gesture in milliseconds. User given value could be automatically adjusted by the framework if it is below the minimum velocity to be a flick gesture.</p> <pre><code> Valid options properties for the
pinch
gesture:</code></pre> -
[center]
Array optional<p>(Optional) The center of the circle where two fingers are placed. Default is the center of the node element.</p>
-
[r1]
Number optional<p>(Required) Pixel radius of the start circle where 2 fingers will be on when the gesture starts. The circles are centered at the center of the element.</p>
-
[r2]
Number optional<p>(Required) Pixel radius of the end circle when this gesture ends.</p>
-
[duration=1000]
Number optional<p>(Optional) The duration of the gesture in milliseconds.</p>
-
[start=0]
Number optional<p>(Optional) Starting degree of the first finger. The value is relative to the path of the north. Default is 0 (i.e., 12:00 on a clock).</p>
-
[rotation=0]
Number optional<p>(Optional) Degrees to rotate from the starting degree. A negative value means rotation to the counter-clockwise direction.</p> <pre><code> Valid options properties for the
rotate
gesture:</code></pre> -
[center]
Array optional<p>(Optional) The center of the circle where two fingers are placed. Default is the center of the node element.</p>
-
[r1]
Number optional<p>(Optional) Pixel radius of the start circle where 2 fingers will be on when the gesture starts. The circles are centered at the center of the element. Default is a fourth of the node element width or height, whichever is smaller.</p>
-
[r2]
Number optional<p>(Optional) Pixel radius of the end circle when this gesture ends. Default is a fourth of the node element width or height, whichever is smaller.</p>
-
[duration=1000]
Number optional<p>(Optional) The duration of the gesture in milliseconds.</p>
-
[start=0]
Number optional<p>(Optional) Starting degree of the first finger. The value is relative to the path of the north. Default is 0 (i.e., 12:00 on a clock).</p>
-
[rotation]
Number optional<p>(Required) Degrees to rotate from the starting degree. A negative value means rotation to the counter-clockwise direction.</p>
-
-
[cb]
Function optional<p>The callback to execute when the asynchronouse gesture simulation is completed.</p>
-
err
Error<p>An error object if the simulation is failed.</p>
-
Example:
var node = Y.one("#target");
// double tap example
node.simulateGesture("doubletap", function() {
// my callback function
});
// flick example from the center of the node, move 50 pixels down for 50ms)
node.simulateGesture("flick", {
axis: y,
distance: -100
duration: 50
}, function() {
// my callback function
});
// simulate rotating a node 75 degrees counter-clockwise
node.simulateGesture("rotate", {
rotation: -75
});
// simulate a pinch and a rotation at the same time.
// fingers start on a circle of radius 100 px, placed at top/bottom
// fingers end on a circle of radius 50px, placed at right/left
node.simulateGesture("pinch", {
r1: 100,
r2: 50,
start: 0
rotation: 90
});
submit
()
chainable
Passes through to DOM method. Only valid on FORM elements
subscribe
()
deprecated
subscribe to an event
swallowEvent
-
eventName
-
preventDefault
Stops the specified event(s) from bubbling and optionally prevents the default action.
Example:
var anchor = A.one('a#anchorId');
anchor.swallowEvent('click');
Parameters:
-
eventName
String | Array<p>An event or array of events to stop from bubbling</p>
-
preventDefault
Boolean<p>(optional) true to prevent the default action too</p>
swap
-
otherNode
Swap DOM locations with the given node. This does not change which DOM node each Node instance refers to.
Parameters:
-
otherNode
Node<p>The node to swap with</p>
swapXY
-
otherNode
Swaps the XY position of this node with another node.
Parameters:
-
otherNode
Node | HTMLElement<p>The node to swap with.</p>
test
-
selector
Test if the supplied node matches the supplied selector.
Parameters:
-
selector
String<p>The CSS selector to test against.</p>
Returns:
<p>Whether or not the node matches the selector.</p>
text
-
text
Gets or sets the combined text contents of the node instance, including
it's descendants. If the text
is passed it's set the content of the
element, otherwise it works as a getter for the current content.
Example:
var node = A.one('#nodeId');
node.text('Setting new text content');
// Alert the value of the current content
alert( node.text() );
Parameters:
-
text
String<p>A string of text to set as the content of the node instance.</p>
toggle
-
on
-
callback
Displays or hide the node instance.
NOTE: This method assume that your node were hidden because of the
'aui-hide' css class were being used. This won't manipulate the inline
style.display
property.
Parameters:
-
on
Boolean<p>Whether to force the toggle. Optional.</p>
-
callback
Function<p>A function to run after the visibility change. Optional.</p>
toggleClass
-
className
-
force
If the className exists on the node it is removed, if it doesn't exist it is added.
Parameters:
-
className
String<p>the class name to be toggled</p>
-
force
Boolean<p>Option to force adding or removing the class.</p>
toggleView
-
[on]
-
[callback]
Displays or hides the node. If the "transition" module is loaded, toggleView optionally animates the toggling of the node using given named effect.
Parameters:
-
[on]
Boolean optional<p>An optional boolean value to force the node to be shown or hidden</p>
-
[callback]
Function optional<p>An optional function to run after the transition completes.</p>
toString
()
String
The method called when outputting Node instances as strings
Returns:
<p>A string representation of the Node instance</p>
transition
-
config
-
callback
Animate one or more css properties to a given value. Requires the "transition" module. <pre>example usage: Y.one('#demo').transition({ duration: 1, // in seconds, default is 0.5 easing: 'ease-out', // default is 'ease' delay: '1', // delay start for 1 second, default is 0
height: '10px',
width: '10px',
opacity: { // per property
value: 0,
duration: 2,
delay: 2,
easing: 'ease-in'
}
});
</pre>
Parameters:
-
config
Object<p>An object containing one or more style properties, a duration and an easing.</p>
-
callback
Function<p>A function to run after the transition has completed.</p>
unplug
-
plugin
Unregisters any class level plugins which have been registered by the Node
Parameters:
-
plugin
Function | ArrayThe plugin class, or an array of plugin classes
unselectable
-
noRecurse
Disables text selection for this element (normalized across browsers).
Parameters:
-
noRecurse
Object
unsubscribe
()
deprecated
detach a listener
unsubscribeAll
-
type
Removes all listeners from the specified event. If the event type is not specified, all listeners from all hosted custom events will be removed.
Parameters:
-
type
String<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>The type, or name of the event</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>
unwrap
()
chainable
Removes the node's parent node.
val
-
value
Gets or sets the value attribute of the node instance. If the value
is
passed it's set the value of the element, otherwise it works as a getter
for the current value.
Example:
var input = A.one('#inputId');
input.val('Setting new input value');
// Alert the value of the input
alert( input.val() );
Parameters:
-
value
String<p>Value to be set. Optional.</p>
width
()
Number
Returns the width of the content, not including the padding, border or margin. If a width is passed, the node's overall width is set to that size.
Example:
var node = A.one('#nodeId');
node.width(); //return content width
node.width(100); // sets box width
Returns:
wrap
-
html
Wraps the given HTML around the node.
Parameters:
-
html
String<p>The markup to wrap around the node.</p>
Properties
_instances
Object
private
static
A list of Node instances that have been created
_node
HTMLElement
private
The underlying DOM node bound to the Y.Node instance
ATTRS
Object
static
Static collection of configuration attributes for special handling
DOM_EVENTS
Unknown
static
List of events that route to DOM events
NAME
String
static
The name of the component