Changeset 7002

Show
Ignore:
Timestamp:
01/07/07 23:53:57 (2 years ago)
Author:
liucougar
Message:

separate getParentOfType API from getAncestorElement

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/html/selection.js

    r6523 r7002  
    214214                //              Return the parent element of the current selection which is of type tagName (or one of the other specified tagName) 
    215215                var node = dojo.html.selection.getSelectedElement() || dojo.html.selection.getParentElement(); 
    216                 while(node /*&& node.tagName.toLowerCase() != 'body'*/){ 
    217                         if(dojo.html.selection.isTag(node, arguments).length>0){ 
     216                return dojo.html.selection.getParentOfType(node, arguments); 
     217        }, 
     218        getParentOfType: function(/*DomNode*/node, /*Array*/tags){ 
     219                while(node){ 
     220                        if(dojo.html.selection.isTag(node, tags).length>0){ 
    218221                                return node; 
    219222                        } 
     
    348351                        var selection = dojo.global().getSelection(); 
    349352 
    350                         for ( var i = 0; i < selection.rangeCount; i++ ){ 
    351                                 selection.getRangeAt(i).deleteContents(); 
    352                         } 
     353                        selection.deleteFromDocument(); 
    353354                 
    354355                        return selection;