Changeset 794 for trunk/modules/Gecko


Ignore:
Timestamp:
03/22/07 17:42:20 (12 years ago)
Author:
ray
Message:

added functions to handle storing/restoring of selections: Xinha.prototype.saveSelection/Xinha.prototype.restoreSelection

/** 
 * Returns a range object to be stored 
 * and later restored with Xinha.prototype.restoreSelection()
 * 
 * @returns Range
 */
Xinha.prototype.saveSelection = function()

/** 
 * Restores a selection previously stored
 * @param savedSelection Range object as returned by Xinha.prototype.restoreSelection()
 */
Xinha.prototype.restoreSelection = function(savedSelection)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/Gecko/Gecko.js

    r771 r794  
    528528}; 
    529529 
    530  
     530/**  
     531 * Returns a range object to be stored  
     532 * and later restored with Xinha.prototype.restoreSelection() 
     533 *  
     534 * @returns Range 
     535 */ 
     536Xinha.prototype.saveSelection = function() 
     537{ 
     538  return this.createRange(this.getSelection()).cloneRange(); 
     539} 
     540/**  
     541 * Restores a selection previously stored 
     542 * @param savedSelection Range object as returned by Xinha.prototype.restoreSelection() 
     543 */ 
     544Xinha.prototype.restoreSelection = function(savedSelection) 
     545{ 
     546  var sel = this.getSelection(); 
     547  sel.removeAllRanges(); 
     548  sel.addRange(savedSelection); 
     549} 
    531550/** 
    532551 * Selects the contents of the given node.  If the node is a "control" type element, (image, form input, table) 
Note: See TracChangeset for help on using the changeset viewer.