1 /** 2 * RichDom for Gecko 3 */ 4 xq.RichDomGecko = xq.Class(xq.RichDomW3, { 5 makePlaceHolder: function() { 6 var holder = this.createElement("BR"); 7 holder.setAttribute("type", "_moz"); 8 return holder; 9 }, 10 11 makePlaceHolderString: function() { 12 return '<br type="_moz" />'; 13 }, 14 15 makeEmptyParagraph: function() { 16 return this.createElementFromHtml('<p><br type="_moz" /></p>'); 17 }, 18 19 isPlaceHolder: function(node) { 20 if(node.nodeType != 1) return false; 21 22 var typeMatches = node.nodeName == "BR" && node.getAttribute("type") == "_moz"; 23 if(typeMatches) return true; 24 25 var positionMatches = node.nodeName == "BR" && !this.getNextSibling(node); 26 if(positionMatches) return true; 27 28 return false; 29 }, 30 31 selectElement: function(element, entireElement) { 32 if(!element) throw "[element] is null"; 33 if(element.nodeType != 1) throw "[element] is not an element"; 34 35 // required to avoid Windows FF selection bug. 36 try { 37 if(!xq.Browser.isMac) this.doc.execCommand("SelectAll", false, null); 38 } catch(ignored) {} 39 40 if(entireElement) { 41 this.rng().selectNode(element); 42 } else { 43 this.rng().selectNodeContents(element); 44 } 45 } 46 }); 47