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

dojo/NodeList-data.js

  • Provides:

    • dojo.NodeList-data
  • dojo.NodeList

    • type
      Function
  • dojo.NodeList.data

    • parameters:
      • key: (typeof Object|String)
        If an object, act as a setter and iterate over said object setting data items as defined.
        If a string, and <code>value</code> present, set the data for defined <code>key</code> to <code>value</code>
        If a string, and <code>value</code> absent, act as a getter, returning the data associated with said <code>key</code>
      • value: (typeof Anything)
        The value to set for said <code>key</code>, provided <code>key</code> is a string (and not an object)
    • summary
      stash or get some arbitrary data on/from these nodes.
    • description
      Stash or get some arbirtrary data on/from these nodes. This private _data function is
      exposed publicly on `dojo.NodeList`, eg: as the result of a `dojo.query` call.
      DIFFERS from jQuery.data in that when used as a getter, the entire list is ALWAYS
      returned. EVEN WHEN THE LIST IS length == 1.
      
      A single-node version of this function is provided as `dojo._nodeData`, which follows
      the same signature, though expects a String ID or DomNode reference in the first
      position, before key/value arguments.
      
      node: String|DomNode
      The node to associate data with
    • example
      Set a key `bar` to some data, then retrieve it.
      	dojo.query(".foo").data("bar", "touched");
      	var touched = dojo.query(".foo").data("bar");
      	if(touched[0] == "touched"){ alert('win'); }
    • example
      Get all the data items for a given node.
      	var list = dojo.query(".foo").data();
      	var first = list[0];
    • example
      Set the data to a complex hash. Overwrites existing keys with new value
      	dojo.query(".foo").data({ bar:"baz", foo:"bar" });
      Then get some random key:
      	dojo.query(".foo").data("foo"); // returns [`bar`]
    • return_summary
      Object|Anything|Nothing
      When used as a setter via `dojo.NodeList`, a NodeList instance is returned
      for further chaning. When used as a getter via `dojo.NodeList` an ARRAY
      of items is returned. The items in the array correspond to the elements
      in the original list. This is true even when the list length is 1, eg:
      when looking up a node by ID (#foo)
    • type
      Function
  • dojo.NodeList.removeData

    • parameters:
      • key: (typeof String)
        If ommitted, clean all data for this node.
        If passed, remove the data item found at <code>key</code>
    • summary
      Remove the data associated with these nodes.
    • type
      Function
  • dojo._nodeDataCache

    • summary
      An alias to the private dataCache for NodeList-data. NEVER USE THIS!
      This private is only exposed for the benefit of unit testing, and is
      removed during the build process.
    • alias - dataCache
    • type
      Object
  • dojo._nodeData

    • parameters:
      • node
      • key
      • value
    • returns
      Object|Anything|Nothing
    • type
      Function
  • dojo._removeNodeData

    • parameters:
      • node: (typeof String|DomNode)
        The node reference to remove data from
      • key: (typeof String)
        If omitted, remove all data in this dataset.
        If passed, remove only the passed <code>key</code> in the associated dataset
    • summary
      Remove some data from this node
    • type
      Function
  • dojo._gcNodeData

    • summary
      super expensive: GC all data in the data for nodes that no longer exist in the dom.
    • description
      super expensive: GC all data in the data for nodes that no longer exist in the dom.
      MUCH safer to do this yourself, manually, on a per-node basis (via `NodeList.removeData()`)
      provided as a stop-gap for exceptionally large/complex applications with constantly changing
      content regions (eg: a dijit.layout.ContentPane with replacing data)
      There is NO automatic GC going on. If you dojo.destroy() a node, you should _removeNodeData
      prior to destruction.
    • type
      Function
  • dojo.NodeList-data

    • type
      Object
  • dojo

    • type
      Object