| 123 | | // |
| 124 | | // But, when manipulating document.domain (#123), we had |
| 125 | | // "Permission denied" errors when trying to call methods inside |
| 126 | | // the returned object. To avoid it, we have to change to the |
| 127 | | // following, by implementing a "custom" DOM document object, which |
| 128 | | // includes the methods that are useful for us. |
| 129 | | |
| 130 | | var domDoc = document.createDocumentFragment() ; |
| 131 | | |
| 132 | | domDoc.createElement = function( name ) |
| 133 | | { |
| 134 | | return document.createElement( name ) ; |
| 135 | | } |
| 136 | | |
| 137 | | domDoc.createTextNode = function( text ) |
| 138 | | { |
| 139 | | return document.createTextNode( text ) ; |
| 140 | | } |
| 141 | | |
| 142 | | domDoc.createAttribute = function( attName ) |
| 143 | | { |
| 144 | | return document.createAttribute( attName ) ; |
| 145 | | } |
| 146 | | |
| 147 | | domDoc.createComment = function( text ) |
| 148 | | { |
| 149 | | return document.createComment( text ) ; |
| 150 | | } |
| 151 | | |
| 152 | | return domDoc ; |
| | 123 | // But that doesn't work if we're running under domain relaxation mode, so we need a workaround. |
| | 124 | // See http://ajaxian.com/archives/xml-messages-with-cross-domain-json about the trick we're using. |
| | 125 | var doc = ( new DOMParser() ).parseFromString( '<tmp></tmp>', 'text/xml' ) ; |
| | 126 | FCKDomTools.RemoveNode( doc.firstChild ) ; |
| | 127 | return doc ; |