src/basis/dom/wrapper.js
function(selection, silent){
      var oldSelection = this.selection;

      if (selection instanceof Selection === false)
        selection = selection ? new Selection(selection) : null;

      if (oldSelection !== selection)
      {
        // change context selection for child nodes
        updateNodeContextSelection(this, oldSelection || this.contextSelection, selection || this.contextSelection, false, true);

        if (this.listen.selection)
        {
          if (oldSelection)
            oldSelection.removeHandler(this.listen.selection, this);
          if (selection)
            selection.addHandler(this.listen.selection, this);
        }

        // update selection
        this.selection = selection;
        if (!silent)
          this.emit_selectionChanged(oldSelection);

        return true;
      }
    }
function(selection, silent){
      var oldSelection = this.selection;

      if (selection instanceof Selection === false)
        selection = selection ? new Selection(selection) : null;

      if (oldSelection !== selection)
      {
        // change context selection for child nodes
        updateNodeContextSelection(this, oldSelection || this.contextSelection, selection || this.contextSelection, false, true);

        if (this.listen.selection)
        {
          if (oldSelection)
            oldSelection.removeHandler(this.listen.selection, this);
          if (selection)
            selection.addHandler(this.listen.selection, this);
        }

        // update selection
        this.selection = selection;
        if (!silent)
          this.emit_selectionChanged(oldSelection);

        return true;
      }
    }
function ( selection , silent ) { var oldSelection = this . selection ; if ( selection instanceof Selection === false ) selection = selection ? new Selection ( selection ) : null ; if ( oldSelection !== selection ) { // change context selection for child nodes updateNodeContextSelection ( this , oldSelection || this . contextSelection , selection || this . contextSelection , false , true ) ; if ( this . listen . selection ) { if ( oldSelection ) oldSelection . removeHandler ( this . listen . selection , this ) ; if ( selection ) selection . addHandler ( this . listen . selection , this ) ; } // update selection this . selection = selection ; if ( ! silent ) this . emit_selectionChanged ( oldSelection ) ; return true ; } }
Changes selection property of node.
@param {basis.dom.wrapper.Selection=} selection New selection value for node.
@return {boolean} Returns true if selection was changed.
Changes selection property of node .