Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojox/NodeList/delegate.js

  • Provides:

    • dojox.NodeList.delegate
  • Requires:

    • dojo.NodeList-traverse in common
  • dojo.NodeList

    • type
      Function
  • dojo.NodeList.delegate

    • parameters:
      • selector: (typeof String)
        CSS selector valid to <code>dojo.query</code>, like &quot;.foo&quot; or &quot;div &gt; span&quot;.  The
        selector is relative to the nodes in this NodeList, not the document root.
        For example myNodeList.delegate(&quot;&gt; a&quot;, &quot;onclick&quot;, ...) will catch events on
        anchor nodes which are (immediate) children of the nodes in myNodeList.
      • eventName: (typeof String)
        Standard event name used as an argument to <code>dojo.connect</code>, like &quot;onclick&quot;.
      • fn: (typeof Function)
        Callback function passed the event object, and where this == the node that matches the selector.
        That means that for example, after setting up a handler via
        dojo.query(&quot;body&quot;).delegate(&quot;fieldset&quot;, &quot;onclick&quot;, ...)
        clicking on a fieldset or *any nodes inside of a fieldset* will be reported
        as a click on the fieldset itself.
    • summary
      Monitor nodes in this NodeList for [bubbled] events on nodes that match selector.
      Calls fn(evt) for those events, where (inside of fn()), this == the node
      that matches the selector.
    • description
      Sets up event handlers that can catch events on any subnodes matching a given selector,
      including nodes created after delegate() has been called.
      
      This allows an app to setup a single event handler on a high level node, rather than many
      event handlers on subnodes. For example, one onclick handler for a Tree widget, rather than separate
      handlers for each node in the tree.
      Since setting up many event handlers is expensive, this can increase performance.
      
      Note that delegate() will not work for events that don't bubble, like focus.
      onmouseenter/onmouseleave also don't currently work.
    • example
      	dojo.query("navbar").delegate("a", "onclick", function(evt){
      			console.log("user clicked anchor ", this.node);
      	});
    • type
      Function
  • dojox.NodeList.delegate

    • type
      Object
  • dojox.NodeList

    • type
      Object
  • dojox

    • type
      Object