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.
NOTE: Node properties are accessed using
+the set and get methods.
Constructor
+Node
+
+
+ -
+
+
-
+
+
node+ +
+
+
Parameters:
+ +-
+
+
-
+
+
node+ DOMNode + + + + +++ + +the DOM node to be mapped to the Node instance.
+
+
+
-
+
- Index + + +
- Methods + + +
- Properties + + +
- Attributes + + +
Item Index
+ + +Methods
+ +-
+
+
- + _get + + + + + +
- + _getFullType + + + + + +
- + _getType + + + + + +
- + _hide + + + + + +
- + _ioComplete + + + + + +
- + _monitor + + + + + +
- + _parseType + + + + + +
- + _publish + + + + + +
- + _show + + + + + +
- + addClass + + + + + +
- + addMethod + + + static + + + + +
- + addTarget + + + + + +
- + after + + + + + +
- + all + + + + + +
- + ancestor + + + + + +
- + ancestors + + + + + +
- + append + + + + + +
- + appendChild + + + + + +
- + appendTo + + + + + +
- + before + + + + + +
- + blur + + + + + +
- + bubble + + + + + +
- + clearData + + + + + +
- + cloneNode + + + + + +
- + compareTo + + + + + +
- + contains + + + + + +
- + create + + + + + +
- + create + + + static + + + + +
- + createCaption + + + + + +
- + DEFAULT_GETTER + + + static + + + + +
- + DEFAULT_SETTER + + + static + + + + +
- + delegate + + + + + +
- + destroy + + + + + +
- + detach + + + + + +
- + detachAll + + + + + +
- + empty + + + + + +
- + fire + + + + + +
- + focus + + + + + +
- + generateID + + + + + +
- + get + + + + + +
- + getAttribute + + + + + +
- + getAttrs + + + + + +
- + getComputedStyle + + + + + +
- + getContent + + + + deprecated + + + +
- + getData + + + + + +
- + getDOMNode + + + static + + + + +
- + getDOMNode + + + + + +
- + getElementsByTagName + + + + + +
- + getEvent + + + + + +
- + getHTML + + + + + +
- + getStyle + + + + + +
- + getTargets + + + + + +
- + getX + + + + + +
- + getXY + + + + + +
- + getY + + + + + +
- + hasAttribute + + + + + +
- + hasChildNodes + + + + + +
- + hasClass + + + + + +
- + hide + + + + + +
- + importMethod + + + static + + + + +
- + inDoc + + + + + +
- + inRegion + + + + + +
- + insert + + + + + +
- + insertBefore + + + + + +
- + intersect + + + + + +
- + invoke + + + + + +
- + load + + + + + +
- + next + + + + + +
- + on + + + + + +
- + once + + + + + +
- + onceAfter + + + + + +
- + one + + + + + +
- + one + + + static + + + + +
- + parseType + + + + + +
- + plug + + + static + + + + +
- + prepend + + + + + +
- + previous + + + + + +
- + publish + + + + + +
- + purge + + + + + +
- + remove + + + + + +
- + removeAttribute + + + + + +
- + removeChild + + + + + +
- + removeClass + + + + + +
- + removeTarget + + + + + +
- + replace + + + + + +
- + replaceChild + + + + + +
- + replaceClass + + + + + +
- + reset + + + + + +
- + scrollIntoView + + + + + +
- + scrubVal + + + static + + + + +
- + select + + + + + +
- + set + + + + + +
- + setAttribute + + + + + +
- + setAttrs + + + + + +
- + setContent + + + + deprecated + + + +
- + setData + + + + + +
- + setHTML + + + + + +
- + setStyle + + + + + +
- + setStyles + + + + + +
- + setX + + + + + +
- + setXY + + + + + +
- + setY + + + + + +
- + show + + + + + +
- + siblings + + + + + +
- + simulate + + + + + +
- + simulateGesture + + + + + +
- + submit + + + + + +
- + subscribe + + + + deprecated + + + +
- + swap + + + + + +
- + swapXY + + + + + +
- + test + + + + + +
- + toggleClass + + + + + +
- + toggleView + + + + + +
- + toString + + + + + +
- + transition + + + + + +
- + unplug + + + static + + + + +
- + unsubscribe + + + + deprecated + + + +
- + unsubscribeAll + + + + deprecated + + + +
- + unwrap + + + + + +
- + wrap + + + + + +
Properties
+ +-
+
+
- + _instances + + + static + + + + +
- + _node + + + + + +
- + ATTRS + + + static + + + + +
- + DOM_EVENTS + + + static + + + + +
- + NAME + + + static + + + + +
Attributes
+ +-
+
+
- + children + + +
- + docHeight + + +
- + docScrollX + + +
- + docScrollY + + +
- + docWidth + + +
- + for + + +
- + region + + +
- + text + + +
- + viewportRegion + + +
- + winHeight + + +
- + winWidth + + +
Methods
+ + +_get
+
+
+ -
+
+
-
+
+
attr+ +
+
+
Helper method for get.
+Parameters:
+ +-
+
+
-
+
+
attr+ String + + + + +++ + +The attribute
+
+
+
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 + + + + +++ + +The short type to prefix
+
+
+
Returns:
+ +_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.
+_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'.
+_ioComplete
+
+
+ -
+
+
-
+
+
code+ +
+
+ -
+
+
response+ +
+
+ -
+
+
args+ +
+
+
The default IO complete handler.
+_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 -> +clickattach, clickdetach, 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 + + + + +++ + +'attach', 'detach', 'fire', or 'publish'
+
+
+ -
+
+
eventType+ String | CustomEvent + + + + +++ + +The prefixed name of the event being monitored, or the CustomEvent object.
+
+
+ -
+
+
o+ Object + + + + +++ + +Information about the event interaction, such as + fire() args, subscription category, publish config
+
+
+
_parseType
+
+
+ ()
+
+
+
+
+
+
+
+ private
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns an array with the detach key (if provided), +and the prefixed event name from _getType +Y.on('detachcategory| menu:click', fn)
+_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 + + + + +++ + +The prefixed type of the event to publish.
+
+
+ -
+
+
etOpts+ Object + + + + +++ + +The EventTarget specific configuration to mix into the published event.
+
+
+ -
+
+
ceOpts+ Object + + + + +++ + +The publish specific configuration to mix into the published event.
+
+
+
Returns:
+ +etOpts or ceOpts, this will
+be the default CustomEvent instance, and can be configured independently.
+
+ _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 each node.
+Parameters:
+ +-
+
+
-
+
+
className+ String + + + + +++ + +the class name to add to the node's class attribute
+
+
+
addMethod
+
+
+ -
+
+
-
+
+
name+ +
+
+ -
+
+
fn+ +
+
+ -
+
+
context+ +
+
+
Adds methods to the Y.Node prototype, routing through scrubVal.
+Parameters:
+ + +Returns:
+ +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 + + + + +++ + +the target to add
+
+
+
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 + + + + +++ + +The name of the event
+
+
+ -
+
+
fn+ Function + + + + +++ + +The callback to execute in response to the event
+
+
+ -
+
+
[context]+ Object + optional + + + + +++ + +Override
+thisobject in callback
+
+ -
+
+
[arg*]+ Any + optional + + + + +++ + +0..n additional arguments to supply to the subscriber
+
+
+
Returns:
+ +all
+
+
+ -
+
+
-
+
+
selector+ +
+
+
Retrieves a NodeList based on the given CSS selector.
+Parameters:
+ +-
+
+
-
+
+
selector+ String + + + + +++ + +The CSS selector to test against.
+
+
+
Returns:
+ +ancestor
+
+
+ -
+
+
-
+
+
fn+ +
+
+ -
+
+
testSelf+ +
+
+ -
+
+
stopFn+ +
+
+
Returns the nearest ancestor that passes the test applied by supplied boolean method.
+Parameters:
+ +-
+
+
-
+
+
fn+ String | Function + + + + +++ + +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.
+
+
+ -
+
+
testSelf+ Boolean + + + + +++ + +optional Whether or not to include the element in the scan
+
+
+ -
+
+
stopFn+ String | Function + + + + +++ + +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.
+
+
+
Returns:
+ +ancestors
+
+
+ -
+
+
-
+
+
fn+ +
+
+ -
+
+
testSelf+ +
+
+
Returns the ancestors that pass the test applied by supplied boolean method.
+Parameters:
+ +-
+
+
-
+
+
fn+ String | Function + + + + +++ + +A selector string or boolean method for testing elements.
+
+
+ -
+
+
testSelf+ Boolean + + + + +++ + +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.
+
+
+
Returns:
+ +append
+
+
+ -
+
+
-
+
+
content+ +
+
+
Inserts the content as the lastChild of the node.
+Parameters:
+ +-
+
+
-
+
+
content+ String | Node | HTMLElement + + + + +++ + +The content to insert +Use
+Y.Escape.html()+to escape html content.
+
+
appendChild
+
+
+ -
+
+
-
+
+
node+ +
+
+
Parameters:
+ +-
+
+
-
+
+
node+ String | HTMLElement | Node + + + + +++ + +Node to be appended +Use
+Y.Escape.html()+to escape html content.
+
+
Returns:
+ +appendTo
+
+
+ -
+
+
-
+
+
node+ +
+
+
Appends the node to the given node.
+Parameters:
+ +-
+
+
-
+
+
node+ Node | HTMLElement + + + + +++ + +The node to append to
+
+
+
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:
+ +blur
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chainable
+
+
+
+
+
+
+ Passes through to DOM method.
+bubble
+
+
+ -
+
+
-
+
+
evt+ +
+
+
Propagate an event. Requires the event-custom-complex module.
+Parameters:
+ +-
+
+
-
+
+
evt+ CustomEvent + + + + +++ + +the custom event to propagate
+
+
+
Returns:
+ +clearData
+
+
+ -
+
+
-
+
+
name+ +
+
+
Clears internally stored data.
+Parameters:
+ +-
+
+
-
+
+
name+ String + + + + +++ + +The name of the field to clear. If no name +is given, all data is cleared.
+
+
+
cloneNode
+
+
+ -
+
+
-
+
+
deep+ +
+
+
Passes through to DOM method.
+Parameters:
+ +-
+
+
-
+
+
deep+ Boolean + + + + +++ + +Whether or not to perform a deep clone, which includes +subtree and attributes
+
+
+
Returns:
+ +compareTo
+
+
+ -
+
+
-
+
+
refNode+ +
+
+
Compares nodes to determine if they match. +Node instances can be compared to each other and/or HTMLElements.
+Parameters:
+ +-
+
+
-
+
+
refNode+ HTMLElement | Node + + + + +++ + +The reference node to compare to the node.
+
+
+
Returns:
+ +contains
+
+
+ -
+
+
-
+
+
needle+ +
+
+
Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
+Parameters:
+ +-
+
+
-
+
+
needle+ Node | HTMLElement + + + + +++ + +The possible node or descendent
+
+
+
Returns:
+ +create
+
+
+ -
+
+
-
+
+
html+ +
+
+ -
+
+
doc+ +
+
+
Creates a new Node using the provided markup string.
+Parameters:
+ +-
+
+
-
+
+
html+ String + + + + +++ + +The markup used to create the element. +Use
+Y.Escape.html()+to escape html content.
+
+ -
+
+
doc+ HTMLDocument + + + + +++ + +An optional document context
+
+
+
Returns:
+ +create
+
+
+ -
+
+
-
+
+
html+ +
+
+ -
+
+
doc+ +
+
+
Returns a new dom node using the provided markup string.
+Parameters:
+ +-
+
+
-
+
+
html+ String + + + + +++ + +The markup used to create the element +Use
+Y.Escape.html()+to escape html content.
+
+ -
+
+
doc+ HTMLDocument + + + + +++ + +An optional document context
+
+
+
Returns:
+ +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+ String + + + + +++ + +The attribute/property to look up
+
+
+
Returns:
+ +DEFAULT_SETTER
+
+
+ -
+
+
-
+
+
name+ +
+
+ -
+
+
val+ +
+
+
The default setter for DOM properties +Called with instance context (this === the Node instance)
+Parameters:
+ +-
+
+
-
+
+
name+ String + + + + +++ + +The attribute/property being set
+
+
+ -
+
+
val+ Any + + + + +++ + +The value to be set
+
+
+
Returns:
+ +delegate
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
fn+ +
+
+ -
+
+
spec+ +
+
+ -
+
+
context+ +
+
+ -
+
+
args+ +
+
+
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.
+ +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.
+ +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
+currentTarget will also be set to the matching Node. The
+containing Node from which the subscription was originally made can be
+referenced as e.container.
Parameters:
+ +-
+
+
-
+
+
type+ String + + + + +++ + +the event type to delegate
+
+
+ -
+
+
fn+ Function + + + + +++ + +the callback function to execute. This function + will be provided the event object for the delegated event.
+
+
+ -
+
+
spec+ String | Function + + + + +++ + +a selector that must match the target of the + event or a function to test target and its parents for a match
+
+
+ -
+
+
context+ Object + + + + +++ + +optional argument that specifies what 'this' refers to.
+
+
+ -
+
+
args+ Any + + + + multiple + + +++ + +0..n additional arguments to pass on to the callback function. + These arguments will be added after the event object.
+
+
+
Returns:
+ +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 + + + + +++ + +(optional) Whether or not to remove listeners from the +node's subtree (default is false)
+
+
+
detach
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
fn+ +
+
+ -
+
+
context+ +
+
+
Detach one or more listeners the from the specified event
+Parameters:
+ +-
+
+
-
+
+
type+ String | Object + + + + +++ + +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.
+
+
+ -
+
+
fn+ Function + + + + +++ + +The subscribed function to unsubscribe, if not + supplied, all subscribers will be removed.
+
+
+ -
+
+
context+ Object + + + + +++ + +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)
+
+
+
Returns:
+ +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 + + + + +++ + +The type, or name of the event
+
+
+
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.
+ +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.
+ +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.
+Parameters:
+ +-
+
+
-
+
+
type+ String | Object + + + + +++ + +The type of the event, or an object that contains +a 'type' property.
+
+
+ -
+
+
arguments+ Object* + + + + +++ + +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.
+
+
+
Returns:
+ +focus
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chainable
+
+
+
+
+
+
+ Passes through to DOM method.
+generateID
+
+
+ ()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Applies a unique ID to the node if none exists
+Returns:
+ +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 + + + + +++ + +The attribute
+
+
+
Returns:
+ +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 + + + + +++ + +The attribute name
+
+
+
Returns:
+ +getAttrs
+
+
+ -
+
+
-
+
+
attrs+ +
+
+
Returns an object containing the values for the requested attributes.
+Parameters:
+ +-
+
+
-
+
+
attrs+ Array + + + + +++ + +an array of attributes to get values
+
+
+
Returns:
+ +getComputedStyle
+
+
+ -
+
+
-
+
+
attr+ +
+
+
Returns the computed value for the given style property. +Use camelCase (e.g. 'backgroundColor') for multi-word properties.
+Parameters:
+ +-
+
+
-
+
+
attr+ String + + + + +++ + +The style attribute to retrieve.
+
+
+
Returns:
+ +getContent
+
+
+ ()
+
+
+
+
+ String
+
+
+
+
+ deprecated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns the node's current content (e.g. innerHTML)
+Returns:
+ +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 + + + + +++ + +Optional name of the data field to retrieve. +If no name is given, all data is returned.
+
+
+
Returns:
+ +getDOMNode
+
+
+ -
+
+
-
+
+
node+ +
+
+
Retrieves the DOM node bound to a Node instance
+Parameters:
+ +-
+
+
-
+
+
node+ Node | HTMLNode + + + + +++ + +The Node instance or an HTMLNode
+
+
+
Returns:
+ +getDOMNode
+
+
+ ()
+
+
+
+
+ DOMNode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns the DOM node bound to the Node instance
+Returns:
+ +getElementsByTagName
+
+
+ -
+
+
-
+
+
tagName+ +
+
+
Passes through to DOM method.
+Parameters:
+ +-
+
+
-
+
+
tagName+ String + + + + +++ + +The tagName to collect
+
+
+
Returns:
+ +getEvent
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
prefixed+ +
+
+
Returns the custom event of the provided type has been created, a +falsy value otherwise
+Parameters:
+ + +Returns:
+ +getHTML
+
+
+ ()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns the node's current html content (e.g. innerHTML)
+Returns:
+ +getStyle
+
+
+ -
+
+
-
+
+
attr+ +
+
+
Returns the style's current value. +Use camelCase (e.g. 'backgroundColor') for multi-word properties.
+Parameters:
+ +-
+
+
-
+
+
attr+ String + + + + +++ + +The style attribute to retrieve.
+
+
+
Returns:
+ +getTargets
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns an array of bubble targets for this object.
+Returns:
+ +getX
+
+
+ ()
+
+
+
+
+ Int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets the current position of the node in page coordinates.
+Returns:
+ +getXY
+
+
+ ()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets the current position of the node in page coordinates.
+Returns:
+ +getY
+
+
+ ()
+
+
+
+
+ Int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets the current position of the node in page coordinates.
+Returns:
+ +hasAttribute
+
+
+ -
+
+
-
+
+
attribute+ +
+
+
Passes through to DOM method.
+Parameters:
+ +-
+
+
-
+
+
attribute+ String + + + + +++ + +The attribute to test for
+
+
+
Returns:
+ +hasChildNodes
+
+
+ ()
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Passes through to DOM method.
+Returns:
+ +hasClass
+
+
+ -
+
+
-
+
+
className+ +
+
+
Determines whether each node has the given className.
+Parameters:
+ +-
+
+
-
+
+
className+ String + + + + +++ + +the class name to search for
+
+
+
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:
+ + +importMethod
+
+
+ -
+
+
-
+
+
host+ +
+
+ -
+
+
name+ +
+
+ -
+
+
altName+ +
+
+ -
+
+
context+ +
+
+
Imports utility methods to be added as Y.Node methods.
+Parameters:
+ +-
+
+
-
+
+
host+ Object + + + + +++ + +The object that contains the method to import.
+
+
+ -
+
+
name+ String + + + + +++ + +The name of the method to import
+
+
+ -
+
+
altName+ String + + + + +++ + +An optional name to use in place of the host name
+
+
+ -
+
+
context+ Object + + + + +++ + +An optional context to call the method with
+
+
+
inDoc
+
+
+ -
+
+
-
+
+
doc+ +
+
+
Determines whether the node is appended to the document.
+Parameters:
+ +-
+
+
-
+
+
doc+ Node | HTMLElement + + + + +++ + +optional An optional document to check against. +Defaults to current document.
+
+
+
Returns:
+ +inRegion
+
+
+ -
+
+
-
+
+
node2+ +
+
+ -
+
+
all+ +
+
+ -
+
+
altRegion+ +
+
+
Determines whether or not the node is within the giving region.
+Parameters:
+ + +Returns:
+ +insert
+
+
+ -
+
+
-
+
+
content+ +
+
+ -
+
+
where+ +
+
+
Inserts the content before the reference node.
+Parameters:
+ +-
+
+
-
+
+
content+ String | Node | HTMLElement | NodeList | HTMLCollection + + + + +++ + +The content to insert +Use
+Y.Escape.html()+to escape html content.
+
+ -
+
+
where+ Int | Node | HTMLElement | String + + + + +++ + +The position to insert at. +Possible "where" arguments
+ +-
+
- Y.Node +
- The Node to insert before +
- HTMLElement +
- The element to insert before +
- Int +
- The index of the child element to insert before +
- "replace" +
- Replaces the existing HTML +
- "before" +
- Inserts before the existing HTML +
- "before" +
- Inserts content before the node +
- "after" +
- Inserts content after the node +
+
+
insertBefore
+
+
+ -
+
+
-
+
+
newNode+ +
+
+ -
+
+
refNode+ +
+
+
Parameters:
+ +-
+
+
-
+
+
newNode+ String | HTMLElement | Node + + + + +++ + +Node to be appended
+
+
+ -
+
+
refNode+ HTMLElement | Node + + + + +++ + +Node to be inserted before +Use
+Y.Escape.html()+to escape html content.
+
+
Returns:
+ +intersect
+
+
+ -
+
+
-
+
+
node2+ +
+
+ -
+
+
altRegion+ +
+
+
Compares the intersection of the node with another node or region
+Parameters:
+ + +Returns:
+ +invoke
+
+
+ -
+
+
-
+
+
method+ +
+
+ -
+
+
a,+ +
+
+
Invokes a method on the Node instance
+Parameters:
+ +-
+
+
-
+
+
method+ String + + + + +++ + +The name of the method to invoke
+
+
+ -
+
+
a,+ Any + + + + +++ + +b, c, etc. Arguments to invoke the method with.
+
+
+
Returns:
+ +load
+
+
+ -
+
+
-
+
+
url+ +
+
+ -
+
+
selector+ +
+
+ -
+
+
callback+ +
+
+
Loads content from the given url and replaces the Node's +existing content with the remote content.
+Parameters:
+ +-
+
+
-
+
+
url+ String + + + + +++ + +The URL to load via XMLHttpRequest.
+
+
+ -
+
+
selector+ String + + + + +++ + +An optional selector representing a subset of an HTML document to load.
+
+
+ -
+
+
callback+ Function + + + + +++ + +An optional function to run after the content has been loaded.
+
+
+
next
+
+
+ -
+
+
-
+
+
fn+ +
+
+
Returns the next matching sibling. +Returns the nearest element node sibling if no method provided.
+Parameters:
+ + +Returns:
+ +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 + + + + +++ + +The name of the event
+
+
+ -
+
+
fn+ Function + + + + +++ + +The callback to execute in response to the event
+
+
+ -
+
+
[context]+ Object + optional + + + + +++ + +Override
+thisobject in callback
+
+ -
+
+
[arg*]+ Any + optional + + + + +++ + +0..n additional arguments to supply to the subscriber
+
+
+
Returns:
+ +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 on except the
+listener is immediatelly detached when it is executed.
Parameters:
+ +-
+
+
-
+
+
type+ String + + + + +++ + +The name of the event
+
+
+ -
+
+
fn+ Function + + + + +++ + +The callback to execute in response to the event
+
+
+ -
+
+
[context]+ Object + optional + + + + +++ + +Override
+thisobject in callback
+
+ -
+
+
[arg*]+ Any + optional + + + + +++ + +0..n additional arguments to supply to the subscriber
+
+
+
Returns:
+ +onceAfter
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
fn+ +
+
+ -
+
+
[context]+ +
+
+ -
+
+
[arg*]+ +
+
+
Listen to a custom event hosted by this object one time.
+This is the equivalent to after except the
+listener is immediatelly detached when it is executed.
Parameters:
+ +-
+
+
-
+
+
type+ String + + + + +++ + +The name of the event
+
+
+ -
+
+
fn+ Function + + + + +++ + +The callback to execute in response to the event
+
+
+ -
+
+
[context]+ Object + optional + + + + +++ + +Override
+thisobject in callback
+
+ -
+
+
[arg*]+ Any + optional + + + + +++ + +0..n additional arguments to supply to the subscriber
+
+
+
Returns:
+ +one
+
+
+ -
+
+
-
+
+
selector+ +
+
+
Retrieves a single Node instance, the first element matching the given +CSS selector. +Returns null if no match found.
+Parameters:
+ +-
+
+
-
+
+
selector+ String + + + + +++ + +The CSS selector to test against.
+
+
+
Returns:
+ +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.
+Note: For chaining purposes you may want to
+use Y.all, which returns a NodeList when no match is found.
Parameters:
+ +-
+
+
-
+
+
node+ String | HTMLElement + + + + +++ + +a node or Selector
+
+
+
Returns:
+ +parseType
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
[pre=this._yuievt.config.prefix]+ +
+
+
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:
+ + +Returns:
+ +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:
+ + +prepend
+
+
+ -
+
+
-
+
+
content+ +
+
+
Inserts the content as the firstChild of the node.
+Parameters:
+ +-
+
+
-
+
+
content+ String | Node | HTMLElement + + + + +++ + +The content to insert +Use
+Y.Escape.html()+to escape html content.
+
+
previous
+
+
+ -
+
+
-
+
+
fn+ +
+
+
Returns the previous matching sibling. +Returns the nearest element node sibling if no method provided.
+Parameters:
+ + +Returns:
+ +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 + + + + +++ + +the type, or name of the event
+
+
+ -
+
+
opts+ Object + + + + +++ + +optional config params. Valid properties are:
+ +-
+
- + 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false) + +
- + 'bubbles': whether or not this event bubbles (true) + Events can only bubble if emitFacade is true. + +
- + 'context': the default execution context for the listeners (this) + +
- + 'defaultFn': the default function to execute when this event fires if preventDefault was not called + +
- + 'emitFacade': whether or not this event emits a facade (false) + +
- + 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click' + +
- + 'fireOnce': if an event is configured to fire once, new subscribers after + the fire will be notified immediately. + +
- + 'async': fireOnce event listeners will fire synchronously if the event has already + fired unless async is true. + +
- + 'preventable': whether or not preventDefault() has an effect (true) + +
- + 'preventedFn': a function that is executed when preventDefault is called + +
- + 'queuable': whether or not this event can be queued during bubbling (false) + +
- + 'silent': if silent is true, debug messages are not provided for this event. + +
- + 'stoppedFn': a function that is executed when stopPropagation is called + + +
- + 'monitored': specifies whether or not this event should send notifications about + when the event has been attached, detached, or published. + +
- + 'type': the event type (valid option if not provided as the first parameter to publish) + +
+
+
Returns:
+ +purge
+
+
+ -
+
+
-
+
+
recurse+ +
+
+ -
+
+
type+ +
+
+
Removes event listeners from the node and (optionally) its subtree
+remove
+
+
+ -
+
+
-
+
+
destroy+ +
+
+
Removes the node from its parent. +Shortcut for myNode.get('parentNode').removeChild(myNode);
+Parameters:
+ +-
+
+
-
+
+
destroy+ Boolean + + + + +++ + +whether or not to call destroy() on the node +after removal.
+
+
+
removeAttribute
+
+
+ -
+
+
-
+
+
attribute+ +
+
+
Passes through to DOM method.
+Parameters:
+ +-
+
+
-
+
+
attribute+ String + + + + +++ + +The attribute to be removed
+
+
+
removeChild
+
+
+ -
+
+
-
+
+
node+ +
+
+
Passes through to DOM method.
+Parameters:
+ +-
+
+
-
+
+
node+ HTMLElement | Node + + + + +++ + +Node to be removed
+
+
+
Returns:
+ +removeClass
+
+
+ -
+
+
-
+
+
className+ +
+
+
Removes a class name from each node.
+Parameters:
+ +-
+
+
-
+
+
className+ String + + + + +++ + +the class name to remove from the node's class attribute
+
+
+
removeTarget
+
+
+ -
+
+
-
+
+
o+ +
+
+
Removes a bubble target
+Parameters:
+ +-
+
+
-
+
+
o+ EventTarget + + + + +++ + +the target to remove
+
+
+
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 | HTMLNode + + + + +++ + +Node to be inserted
+
+
+
replaceChild
+
+
+ -
+
+
-
+
+
node+ +
+
+ -
+
+
refNode+ +
+
+
Parameters:
+ +-
+
+
-
+
+
node+ String | HTMLElement | Node + + + + +++ + +Node to be inserted
+
+
+ -
+
+
refNode+ HTMLElement | Node + + + + +++ + +Node to be replaced
+
+
+
Returns:
+ +replaceClass
+
+
+ -
+
+
-
+
+
oldClassName+ +
+
+ -
+
+
newClassName+ +
+
+
Replace a class with another class for each node. +If no oldClassName is present, the newClassName is simply added.
+reset
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chainable
+
+
+
+
+
+
+ Passes through to DOM method. +Only valid on FORM elements
+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+ Any + + + + +++ + +The Node instance or an HTMLNode
+
+
+
select
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chainable
+
+
+
+
+
+
+ Passes through to DOM method.
+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 + + + + +++ + +The attribute to be set.
+
+
+ -
+
+
val+ Any + + + + +++ + +The value to set the attribute to.
+
+
+
setAttribute
+
+
+ -
+
+
-
+
+
name+ +
+
+ -
+
+
value+ +
+
+
Allows setting attributes on DOM nodes, normalizing in some cases. +This passes through to the DOM node, allowing for custom attributes.
+setAttrs
+
+
+ -
+
+
-
+
+
attrMap+ +
+
+
Sets multiple attributes.
+Parameters:
+ +-
+
+
-
+
+
attrMap+ Object + + + + +++ + +an object of name/value pairs to set
+
+
+
setContent
+
+
+ -
+
+
-
+
+
content+ +
+
+
Replaces the node's current content with the content.
+Note that this passes to innerHTML and is not escaped.
+Use Y.Escape.html()
+to escape html content or set('text') to add as text.
Parameters:
+ +-
+
+
-
+
+
content+ String | Node | HTMLElement | NodeList | HTMLCollection + + + + +++ + +The content to insert
+
+
+
setData
+
+
+ -
+
+
-
+
+
name+ +
+
+ -
+
+
val+ +
+
+
Stores arbitrary data on a Node instance. +This is not stored with the DOM node.
+Parameters:
+ +-
+
+
-
+
+
name+ String + + + + +++ + +The name of the field to set. If no val +is given, name is treated as the data and overrides any existing data.
+
+
+ -
+
+
val+ Any + + + + +++ + +The value to be assigned to the field.
+
+
+
setHTML
+
+
+ -
+
+
-
+
+
content+ +
+
+
Replaces the node's current html content with the content provided.
+Note that this passes to innerHTML and is not escaped.
+Use Y.Escape.html() to escape HTML, or set('text') to add as text.
Parameters:
+ +-
+
+
-
+
+
content+ String | HTML | Node | HTMLElement | NodeList | HTMLCollection + + + + +++ + +The content to insert
+
+
+
setStyle
+
+
+ -
+
+
-
+
+
attr+ +
+
+ -
+
+
val+ +
+
+
Sets a style property of the node. +Use camelCase (e.g. 'backgroundColor') for multi-word properties.
+setStyles
+
+
+ -
+
+
-
+
+
hash+ +
+
+
Sets multiple style properties on the node. +Use camelCase (e.g. 'backgroundColor') for multi-word properties.
+Parameters:
+ +-
+
+
-
+
+
hash+ Object + + + + +++ + +An object literal of property:value pairs.
+
+
+
setX
+
+
+ -
+
+
-
+
+
x+ +
+
+
Set the position of the node in page coordinates, regardless of how the node is positioned.
+Parameters:
+ +-
+
+
-
+
+
x+ Int + + + + +++ + +X value for new position (coordinates are page-based)
+
+
+
setXY
+
+
+ -
+
+
-
+
+
xy+ +
+
+
Set the position of the node in page coordinates, regardless of how the node is positioned.
+Parameters:
+ +-
+
+
-
+
+
xy+ Array + + + + +++ + +Contains X & Y values for new position (coordinates are page-based)
+
+
+
setY
+
+
+ -
+
+
-
+
+
y+ +
+
+
Set the position of the node in page coordinates, regardless of how the node is positioned.
+Parameters:
+ +-
+
+
-
+
+
y+ Int + + + + +++ + +Y value for new position (coordinates are page-based)
+
+
+
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:
+ + +siblings
+
+
+ -
+
+
-
+
+
fn+ +
+
+
Returns all matching siblings. +Returns all siblings if no method provided.
+Parameters:
+ + +Returns:
+ +simulate
+
+
+ -
+
+
-
+
+
type+ +
+
+ -
+
+
options+ +
+
+
Simulates an event on the node.
+Parameters:
+ + +Returns:
+ +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 + + + + +++ + +The name of the supported gesture to simulate. The + supported gesture name is one of "tap", "doubletap", "press", "move", + "flick", "pinch" and "rotate".
+
+
+ -
+
+
[options]+ Object + optional + + + + +++ + +Extra options used to define the gesture behavior:
+ +
+Valid options properties for thetapgesture: +-
+
+
-
+
+
[point]+ Array + optional + + +++ + +(Optional) Indicates the [x,y] coordinates + where the tap should be simulated. Default is the center of the node + element.
+
+
+ -
+
+
[hold=10]+ Number + optional + + +++ + +(Optional) The hold time in milliseconds. + This is the time between
+touchstartandtouchendevent generation.
+
+ -
+
+
[times=1]+ Number + optional + + +++ + +(Optional) Indicates the number of taps.
+
+
+ -
+
+
[delay=10]+ Number + optional + + +++ + +(Optional) The number of milliseconds + before the next tap simulation happens. This is valid only when
+ +times+ is more than 1.
+Valid options properties for thedoubletapgesture: +
+
+ -
+
+
[point]+ Array + optional + + +++ + +(Optional) Indicates the [x,y] coordinates + where the doubletap should be simulated. Default is the center of the + node element.
+ +
+Valid options properties for thepressgesture: +
+
+ -
+
+
[point]+ Array + optional + + +++ + +(Optional) Indicates the [x,y] coordinates + where the press should be simulated. Default is the center of the node + element.
+
+
+ -
+
+
[hold=3000]+ Number + optional + + +++ + +(Optional) The hold time in milliseconds. + This is the time between
+ +touchstartandtouchendevent generation. + Default is 3000ms (3 seconds).
+Valid options properties for themovegesture: +
+
+ -
+
+
[path]+ Object + optional + + +++ + +(Optional) Indicates the path of the finger + movement. It's an object with three optional properties:
+point, +xdistandydist.-
+
+
-
+
+
[point]+ Array + optional + + ++ A starting point of the gesture. + Default is the center of the node element. ++
+
+ -
+
+
[xdist=200]+ Number + optional + + ++ A distance to move in pixels + along the X axis. A negative distance value indicates moving left. ++
+
+ -
+
+
[ydist=0]+ Number + optional + + ++ A distance to move in pixels + along the Y axis. A negative distance value indicates moving up. ++
+
+
+
+ -
+
+
-
+
+
[duration=1000]+ Number + optional + + +++ + +(Optional) The duration of the + gesture in milliseconds.
+ +
+Valid options properties for theflickgesture: +
+
+ -
+
+
[point]+ Array + optional + + +++ + +(Optional) Indicates the [x, y] coordinates + where the flick should be simulated. Default is the center of the + node element.
+
+
+ -
+
+
[axis='x']+ String + optional + + +++ + +(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).
+
+
+ -
+
+
[distance=200]+ Number + optional + + +++ + +(Optional) Distance to move in pixels
+
+
+ -
+
+
[duration=1000]+ Number + optional + + +++ + +(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.
+ +
+Valid options properties for thepinchgesture: +
+
+ -
+
+
[center]+ Array + optional + + +++ + +(Optional) The center of the circle where + two fingers are placed. Default is the center of the node element.
+
+
+ -
+
+
[r1]+ Number + optional + + +++ + +(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.
+
+
+ -
+
+
[r2]+ Number + optional + + +++ + +(Required) Pixel radius of the end circle + when this gesture ends.
+
+
+ -
+
+
[duration=1000]+ Number + optional + + +++ + +(Optional) The duration of the + gesture in milliseconds.
+
+
+ -
+
+
[start=0]+ Number + optional + + +++ + +(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).
+
+
+ -
+
+
[rotation=0]+ Number + optional + + +++ + +(Optional) Degrees to rotate from + the starting degree. A negative value means rotation to the + counter-clockwise direction.
+ +
+Valid options properties for therotategesture: +
+
+ -
+
+
[center]+ Array + optional + + +++ + +(Optional) The center of the circle where + two fingers are placed. Default is the center of the node element.
+
+
+ -
+
+
[r1]+ Number + optional + + +++ + +(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.
+
+
+ -
+
+
[r2]+ Number + optional + + +++ + +(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.
+
+
+ -
+
+
[duration=1000]+ Number + optional + + +++ + +(Optional) The duration of the + gesture in milliseconds.
+
+
+ -
+
+
[start=0]+ Number + optional + + +++ + +(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).
+
+
+ -
+
+
[rotation]+ Number + optional + + +++ + +(Required) Degrees to rotate from + the starting degree. A negative value means rotation to the + counter-clockwise direction.
+
+
+
+
+ -
+
+
-
+
+
[cb]+ Function + optional + + + + +++ + +The callback to execute when the asynchronouse gesture
+
+ simulation is completed.-
+
+
-
+
+
err+ Error + + +++ + +An error object if the simulation is failed.
+
+
+
+
+ -
+
+
Returns:
+ +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
+swap
+
+
+ -
+
+
-
+
+
otherNode+ +
+
+
Swap DOM locations with the given node. +This does not change which DOM node each Node instance refers to.
+Parameters:
+ +-
+
+
-
+
+
otherNode+ Node + + + + +++ + +The node to swap with
+
+
+
swapXY
+
+
+ -
+
+
-
+
+
otherNode+ +
+
+
Swaps the XY position of this node with another node.
+Parameters:
+ +-
+
+
-
+
+
otherNode+ Node | HTMLElement + + + + +++ + +The node to swap with.
+
+
+
test
+
+
+ -
+
+
-
+
+
selector+ +
+
+
Test if the supplied node matches the supplied selector.
+Parameters:
+ +-
+
+
-
+
+
selector+ String + + + + +++ + +The CSS selector to test against.
+
+
+
Returns:
+ +toggleClass
+
+
+ -
+
+
-
+
+
className+ +
+
+ -
+
+
force+ +
+
+
If the className exists on the node it is removed, if it doesn't exist it is added.
+toggleView
+
+
+ -
+
+
-
+
+
[name]+ +
+
+ -
+
+
[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:
+ +-
+
+
-
+
+
[name]+ String + optional + + + + +++ + +An optional string value to use as transition effect.
+
+
+ -
+
+
[on]+ Boolean + optional + + + + +++ + +An optional boolean value to force the node to be shown or hidden
+
+
+ -
+
+
[callback]+ Function + optional + + + + +++ + +An optional function to run after the transition completes.
+
+
+
toString
+
+
+ ()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The method called when outputting Node instances as strings
+Returns:
+ +transition
+
+
+ -
+
+
-
+
+
config+ +
+
+ -
+
+
callback+ +
+
+
Animate one or more css properties to a given value. Requires the "transition" module.
+ +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'
+ }
+ });
+
+ unplug
+
+
+ -
+
+
-
+
+
plugin+ +
+
+
Unregisters any class level plugins which have been registered by the Node
+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 + + + + +++ + +The type, or name of the event
+
+
+
unwrap
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+ chainable
+
+
+
+
+
+
+ Removes the node's parent node.
+wrap
+
+
+ -
+
+
-
+
+
html+ +
+
+
Wraps the given HTML around the node.
+Parameters:
+ +-
+
+
-
+
+
html+ String + + + + +++ + +The markup to wrap around the node.
+
+
+
Properties
+ + +_instances
+ Object
+
+
+
+
+ private
+
+
+
+
+
+ static
+
+
+
+
+ A list of Node instances that have been created
+_node
+ DOMNode
+
+
+
+
+ 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
+Attributes
+ + +children
+ NodeList
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ readonly
+
+
+
+
+ Returns a NodeList instance of all HTMLElement children.
+docScrollX
+ Int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pixel distance the page has been scrolled horizontally
+docScrollY
+ Int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pixel distance the page has been scrolled vertically
+for
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Allows for getting and setting the text of an element. +Formatting is preserved and special characters are treated literally.
+region
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns a region object for the node
+text
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Allows for getting and setting the text of an element. +Formatting is preserved and special characters are treated literally.
+viewportRegion
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns a region object for the node's viewport
+