E4Xã使ã£ã¦XULã«overlayãããµã³ãã«ã³ã¼ã
ææåFirefoxæ¡å¼µæ©è½é å¸ãµã¤ãã®ããã°ãè¦ã¦ããã£ã¨ããæ¹ãåãã£ãã®ã§ããã«ãµã³ãã«ã³ã¼ããç°¡åãªè§£èª¬ãæ¸ãã¦ããã¾ãã
ãµã³ãã«ã³ã¼ã
ã¹ãã¼ã¿ã¹ãã¼ã®ãããã¢ãããããã¯ã¢ã¤ã³ã³ã®æ¨ªã«æ°ããstatusbarpanelã追å ããçºã®ãµã³ãã«ã³ã¼ãã§ãã
var range = document.createRange(); range.selectNodeContents(document.getElementById('status-bar')); range.collapse(false); range.extractContents(); range.setStartAfter(document.getElementById("page-report-button")); range.insertNode(range.createContextualFragment(<![CDATA[ <statusbarpanel label="Hallo World!"/> ]]>.toString().replace(/^[\s\t]*|[\s\t]*$/g, '').replace(/>[\s\t]+</g, '><'))); range.detach();
ã¾ãã¯document.rangeãä½æãããã¦æ¬¡ã«è¿½å ããããã¼ãã¸ã¨ç§»åã
extractContents()ã§ç¾å¨ã®ãã¼ãã®ä¸ã¸ã¨å
¥ããã
setStartAfter()ãå©ç¨ãã¦ã追å ä½ç½®ã調ç¯ï¼ä»åã¯page-report-buttonã®æ¨ªããã®å ´åã¯åºæ¬çã«ã¹ãã¼ã¿ã¹ãã¼ã®ä¸ã§ä¸çªå·¦ã«è¿½å ãããï¼ã
ããã¦insertNode()ã§ç¾å¨ä½ç½®ã«ãã¼ãã追å ã
createContextualFragment()ã¨ããã®ã¯æ¸¡ãããObjectãå¯è½ãªéãdocument fragmentã¨ãã¦è¿ããã®ã§ãããã®å¼æ°ã«ç´æ¥E4Xã®è¨è¿°æ¹æ³ã§overlayããããã®ãæå®ãããã¨ã§DOMè¦ç´ ã«å¤æãããã
ã¡ãªã¿ã«toString()ã§ãã¡ããã¡ããã£ã¦ããçç±ã¯E4Xã¯javascriptã®ã³ã¼ãã«ç´æ¥XMLãæ¸ããçºãããå
é é¨åã«ç©ºç½ãã¿ãã§ã¤ã³ãã³ããããæããã®ã¤ã³ãã³ããé¤å»ããããã§ãã
ä¸ã®ãµã³ãã«ã³ã¼ãããä¸åã¤ã³ãã³ãããªããã大ä¸å¤«ã ãã©ããããããfunctionã®ä¸ã«å
¥ã£ã¦ãããE4Xã®é¨åãã¤ã³ãã³ãããããªãã¾ãããï¼
ã§ãããã®ã¾ã¾ã¤ã³ãã³ããããã®ã渡ãã¨è²ã
ã¨åé¡ãèµ·ããããç¥ããªãã®ã§ãtoString()ãã¦ããã¹ãç½®ãæãã§ã¤ã³ãã³ããé¤å»ããã®ã§ãã
ã¨ã¾ããããã¦æå¾ã«detach()ã§rangeã解æ¾ãã¦çµããã§ãã
ããã ãã§E4Xã使ã£ã¦XULãç°¡åã«overlayãããã¨ãåºæ¥ã¾ãã