Changeset 794 for trunk/modules


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)
Location:
trunk/modules
Files:
2 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) 
  • trunk/modules/InternetExplorer/InternetExplorer.js

    r771 r794  
    279279}; 
    280280 
     281/**  
     282 * Returns a range object to be stored  
     283 * and later restored with Xinha.prototype.restoreSelection() 
     284 *  
     285 * @returns Range 
     286 */ 
     287Xinha.prototype.saveSelection = function() 
     288{ 
     289  return this.createRange(this._getSelection()) 
     290} 
     291/**  
     292 * Restores a selection previously stored 
     293 * @param savedSelection Range object as returned by Xinha.prototype.restoreSelection() 
     294 */ 
     295Xinha.prototype.restoreSelection = function(savedSelection) 
     296{ 
     297  savedSelection.select(); 
     298} 
     299 
    281300/** 
    282301 * 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.