Changeset 13951

Show
Ignore:
Timestamp:
06/09/08 15:02:09 (6 months ago)
Author:
bill
Message:

Fixes for cross-window widget creation.
Make sure not to create a node in one document but then insert it into another.
(Always use dojo.withDoc.)
Otherwise, IE gets upset.
Fixes #6791.
Thanks Masato! (IBM, CCLA on file)
!strict

Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/_Templated.js

    r13521 r13951  
    210210        var cached = tmplts[key]; 
    211211        if(cached){ 
    212                 return cached; 
     212                if(!cached.ownerDocument || cached.ownerDocument == dojo.doc){ 
     213                        // string or node of the same document 
     214                        return cached; 
     215                } 
     216                // destroy the old cached node of a different document 
     217                dojo._destroyElement(cached); 
    213218        } 
    214219 
     
    274279                //      Attempts to create a set of nodes based on the structure of the passed text. 
    275280 
     281                if(tn && tn.ownerDocument != dojo.doc){ 
     282                        // destroy dummy container of a different document 
     283                        dojo._destroyElement(tn); 
     284                        tn = undefined; 
     285                } 
    276286                if(!tn){ 
    277287                        tn = dojo.doc.createElement("div"); 
  • dojo/trunk/_base/html.js

    r13820 r13951  
    8282                node = d.byId(node); 
    8383                try{ 
    84                         if(!_destroyContainer){ 
    85                                 _destroyContainer = document.createElement("div"); 
     84                        if(!_destroyContainer || _destroyContainer.ownerDocument != node.ownerDocument){ 
     85                                _destroyContainer = node.ownerDocument.createElement("div"); 
    8686                        } 
    8787                        _destroyContainer.appendChild(node.parentNode ? node.parentNode.removeChild(node) : node); 
     
    265265=====*/ 
    266266 
    267         var gcs, dv = document.defaultView; 
     267        var gcs; 
    268268        if(d.isSafari){ 
    269269                gcs = function(/*DomNode*/node){ 
     270                        var dv = node.ownerDocument.defaultView; 
    270271                        var s = dv.getComputedStyle(node, null); 
    271272                        if(!s && node.style){  
     
    281282        }else{ 
    282283                gcs = function(node){ 
     284                        var dv = node.ownerDocument.defaultView; 
    283285                        return dv.getComputedStyle(node, null); 
    284286                };