é£ããä»äºã¯äœã§ããïŒ ãŸã第äžã«-iPhoneäžã®éåžžã«äœéã®Webã¢ããªã±ãŒã·ã§ã³ã ããšãã°ãç§ã®äºæ³ã«ãããšãã¢ãã€ã«Safariã¯ãã¹ã¯ãããã®åçåããã100åé ãã§ãã åãæäœããã¹ã¯ãããäžã§10ããªç§éå®è¡ããããŠãŒã¶ãŒããã¯ãŸã£ããèŠããªãå ŽåãiPhoneã§ã¯1ç§ä»¥äžãããããšããããŸãã æ¯èŒã®ããã«ããšã³ãžã³ã®æåã®ããŒãžã§ã³ã§ã¯ãçŽ15ç§ã§å°ããªç« ãããŒãžã«åå²ãããŸããã çŸåšã6ãæåŸã圌ã¯åãããšã1ç§ä»¥å ã«è¡ãã booqã¢ããªã±ãŒã·ã§ã³ã§éåžžã«ããŸãæ©èœããŠããŸãã
ãã®èšäºã§ã¯ãèªè ã®äœææ¹æ³ã«çŠç¹ãåœãŠãã®ã§ã¯ãªããiPhoneçšã®Webã¢ããªã±ãŒã·ã§ã³ãæé©åããçµéšãå ±æããŸãã ãã®èšäºã¯ãã¢ãã€ã«ããã€ã¹ã®éçºè ã ãã§ãªããéåžžã®Webæè¡è ã«ãšã£ãŠãèå³æ·±ããã®ã«ãªããŸãã çµå±ã®ãšãããã¢ããªã±ãŒã·ã§ã³/ãµã€ããã¢ãã€ã«ããã€ã¹äžã§è¿ éã«åäœããå Žåããã¹ã¯ãããäžã§ã©ãã ãé«éã«åäœãããæ³åããŠãã ããã
ææŠãã
ãŸããèªè ã®åºç€ãšããŠWebãã¯ãããžãŒãéžæããçç±ã説æãã䟡å€ããããŸãã ãŸããããã¯åœŒãã®æç çã§ãã çŸåšããã©ãŠã¶ãçµã¿èŸŒãŸããŠããªãããã€ã¹ãèŠã€ããããšã¯éåžžã«å°é£ã§ãã é»è©±ãã³ã³ãã¥ãŒã¿ãŒããããããã¯ãã¿ãã¬ãããé»åæžç±-ãããã¯ãã¹ãŠHTMLãèªã¿ãCSSã§è£ 食ããJavaScriptã§ã¢ãã¡ãŒã·ã§ã³åã§ããŸãã åããšã³ãžã³ã䜿çšããŠãããŸããŸãªãã©ãããã©ãŒã ãããã€ã¹åãã®ã¢ããªã±ãŒã·ã§ã³ãç°¡åã«äœæã§ããŸãã 第äºã«ãåäžã®ãã¯ã©ã·ãã¯ããªãŒããŒãšã³ãžã³ãWebãã©ãŠã¶ãŒã®æ©èœã衚瀺ã§ããªãã ããŒãã«ããã¯ã¿ãŒã°ã©ãã£ãã¯ã¹ããªãŒãã£ãª/ãããªã³ã³ãã³ããã€ã³ã¿ã©ã¯ãã£ããªèŠçŽ -ãããã¯ãã¹ãŠãã©ãŠã¶ãŒã§é·ãéæåããŠããŸãã ç§åŠçãªæ¬ãèªãã§ãããšæ³åããŠãããã«èª¬æãããããã»ã¹ã瀺ããããªãèŠãŸãã ããŠããŸãã¯æ¬¡ã®ç« ãéãããã«ããºã«ãå®æãããå¿ èŠãããæ¢åµå°èª¬ãèªãã§ãã ãã:)ã å¯èœæ§ã¯ãéçºè ã®æ³ååãšã¹ãã«ã«ãã£ãŠã®ã¿å¶éãããŸãã
ãããã¯ãã¹ãŠçŸããããŒã±ãã£ã³ã°ã©ãããŒã§ããã倩ããå°ã«åãã£ãŠãæè¡çãªèŠ³ç¹ãããšã³ãžã³ãã©ãããã¹ãããèŠãŠã¿ãŸãããã
- ã¯ãã¹ãã©ãŠã¶ããã³ã¯ãã¹ãã©ãããã©ãŒã ã§ããããšã
- ããŸããŸãªããã€ã¹ã®ããŒãžã§ã³ãç°¡åã«äœæã§ããããã«ããããã®ã¢ãžã¥ãŒã«æ§é ã
- 2ã€ã®èªã¿åãã¢ãŒãããµããŒãããŸããããŒãžããŒã·ã§ã³ãšã¹ã¯ããŒã«ïŒéåžžã®WebããŒãžã®ããã«ïŒãããã³ãããããã°ããåãæ¿ããŸãã
- 1 MB以äžã®ãã£ãã¿ãŒãåŠçããŸãïŒæ¯èŒã®ããã«ããã«ã¹ãã€ã®æŠäºãšå¹³åã®æåã®ããªã¥ãŒã ã¯1.2 MBã®éãã§ãïŒã
- æè»ãªå€èŠ³èšå®ããããŸãïŒå®éãCSSæ©èœã«ãã£ãŠå¶éãããŸãïŒã
ãã¹ããµã€ããšããŠããã¡ãŒã ãŠã§ã¢3.1ãæèŒãã2G iPhoneãšãIvan Mironovã®èæžãMummifiedãã®500 KBã®ç« ã䜿ããŸããã ãã®ãããªå€§ããªç« ã¯ã«ãŒã«ãšããããã¯äŸå€ã§ãããããã©ãŒãã³ã¹ã®è¯ãæ°Žæºãèšå®ããã®ã§ããããäžåãããšã¯ã§ããŸããã
ããã§ã¯ãæé©åãå§ããŸãããã
JSã³ãŒãããªã¥ãŒã
ããã«ãã¡ã³ãæ··ä¹±ãããŠããŒãžã«ããããã®ãã¬ãŒã ã¯ãŒã¯ãé 眮ãããã©ã°ã€ã³ã§ãããããããã¯ããŠããããã¯ã®ãã©ãã°ãCSSã»ã¬ã¯ã¿ãŒã䜿çšããèŠçŽ ã®éžæãªã©ã®ç°¡åãªã¿ã¹ã¯ã解決ããŸãïŒããŒãžäžã®JSã³ãŒãã®éã¯ãå°ãªããšãã¢ãã€ã«Safariã«ãšã£ãŠéåžžã«éèŠã§ã ããšãã°ãäžè¬çãªjQueryã®è§£æãšåæåã«ã¯ãå ã®éå§çž®ããŒãžã§ã³ïŒ155 KBïŒã§1400ããªç§ãå§çž®ïŒ76 KBïŒã§1200ããªç§ããããŸãã å§çž®ããŒãžã§ã³ã¯å ã®ããŒãžã§ã³ã®2åå°ããã«ãããããããæ©èœçã«ã¯åãã§ãããããã£ãŠã解æé床ã®ãå°ããªãéãããããŸãã ã€ãŸããé床ã¯å€æ°åã®é·ãã§ã¯ãªããé¢æ°ããªããžã§ã¯ããã¡ãœãããªã©ã®æ°ã«åœ±é¿ãããŸãã æ¯èŒã®ããã«ïŒãã¹ã¯ãããã§ã¯ã解æã«çŽ30ããªç§ããããŸãã
çæ³çãªãªãã·ã§ã³ïŒãã¹ãŠã®JSã³ãŒããããŒãžã®äžçªäžã«ä¿æããéåžžã¯ãã¬ãŒã ã¯ãŒã¯ãæŸæ£ããŸãã WebKitèªäœãå€ãã®ããšããµããŒãããŠãããããæšæºã®DOMæäœïŒã€ãã³ãã®è¿œå ãã»ã¬ã¯ã¿ãŒã«ããèŠçŽ ã®æ€çŽ¢ãªã©ïŒãåå¥ã®ã¢ããªã³ã¢ãžã¥ãŒã«ãšããŠã¬ã³ããªã³ã°ãããã®ããŒãžã§ã³ããã¹ã¯ãããããŒãžã§ã³çšã«åå®çŸ©ããŠåŒã³åºããjQueryã§ãããŒããã£ã¹ããããããã«ããŸããã
HTML解æ
èªè èªèº«ã¯ePub圢åŒã«çŠç¹ãåœãŠãŠãããæ¬ã®åç« ã¯XHTML圢åŒã®åå¥ã®ããã¥ã¡ã³ããšããŠæ瀺ãããŠããŸãã ãã®ç« ã¯ãäœããã®æ¹æ³ã§JavaScriptã«æž¡ããŠã解æã解æã衚瀺ãéå§ããå¿ èŠããããŸãã
ããã§ã¯ãç»é¢ã«ã³ã³ãã³ãã衚瀺ããåçã«ã€ããŠããã€ãã®èšèãè¿°ã¹ã䟡å€ããããŸãã ãšã³ãžã³ã2ã€ã®èªã¿åãã¢ãŒãããµããŒãããå¿ èŠãããããšãæãåºãããŠãã ããïŒããŒãžåäœãšããããã¯ãã¹ãã ãããã£ãŠããã¹ãŠã®ã³ã³ãã³ãã2ã€ã®ã©ãããŒã§ãã¬ãŒã åããããšã«ããŸããã1ã€ç®ã¯äžçš®ã®ããŠã£ã³ããŠãã§ã2ã€ç®ã¯ã³ã³ãã³ããäžäžã«ã·ããããŸãã æ£ãããŠã£ã³ããŠãµã€ãºãšã³ã³ãã³ããªãã»ãããéžæããããšã§ãããŒãžåå²ãããç« ã®ãããªé¯èŠãäœæã§ããŸãã
ãããã«ãããç« ã®å å®¹å šäœãå¿ èŠã§ãããããŒãžãµã€ãºã®èšç®ã«ã¯æ¬æ ŒçãªDOMèŠçŽ ãå¿ èŠãªã®ã§ãHTMLã§ç« ãçŽæ¥è¡šç€ºããããšã«ããŸããã
< div id ="window" >
< div id ="content" >
< p > ⊠, ⊠</ p >
</ div >
</ div >
ãããŠãæ·±å»ãªåé¡ã«ã¶ã€ãããŸããã解æãšãããã«ä»éããç« ã®è¡šç€ºãæ倧7ç§ç¶ããŸããã ã»ãšãã©ã®å Žåãã³ã³ãã³ãã®ã¬ã³ããªã³ã°ã«æéãããããšæ³å®ãããããå®éšãšããŠãã³ã³ãã³ãã
display: none
ã§é
display: none
ã
< div id ="window" >
< div id ="content" style ="display:none" >
< p > ⊠, ⊠</ p >
</ div >
</ div >
ä»åã¯ããŒãžã®è§£æã«800ããªç§ããããŸããããããã¯éåžžã«åªããŠããŸãã10åè¿ãå éããŸããã ãŸããiPhoneã®ç»é¢ã¯ããªãå°ãããããæåã®ããã€ãã®èŠçŽ ãããªãŒããåãåºããŠè¡šç€ºããã°ãç« ã®èšç®äžã«ãŠãŒã¶ãŒãèªã¿å§ããããšãã§ããŸãã
ååãšããŠãããã¯ããã©ãŒãã³ã¹ã®é¢ã§ãã§ã«ããªã倧ããªåå©ã§ãããä»ã®ããšãè¡ãããšãå¯èœã§ãããç§ã®çŽæã§ã¯ã解ææéããããã«ççž®ããããšãå¯èœã§ãããšæããŠãããŸããã
HTMLãããã¥ã¡ã³ãã®æ¬æã§æ£ãã解æããããšããã©ãŠã¶ãŒãèŠçŽ ãé©åãªã¿ã€ãã³ã°ã§ããŒãžã«è¡šç€ºã§ããããã«ãããã€ãã®è¿œå æé ãå®è¡ãããšæ³å®ããŸããã ããšãã°ãé©åãªCSSã«ãŒã«ãèŠã€ããŠé©çšããŸãã å人çã«ã¯ãçŸæç¹ã§ã¯ãããã®ã¢ã¯ã·ã§ã³ã¯å¿ èŠãããŸãããç« ã®å 容ãDOMããªãŒãšããŠJavaScriptã«ã§ããã ãæ©ãçŽæ¥è»¢éããå¿ èŠããããŸãã ãã©ãŠã¶ãããã¥ã¡ã³ãã®ç¹å®ã®ãã©ã°ã¡ã³ãã解æããªãããã«ããæ¹æ³ã¯ïŒ å³ãã³ã¡ã³ãã¢ãŠãïŒ
< div id ="window" >
< div id ="content" >
<!--
<p> ⊠, âŠ</p>
-->
</ div >
</ div >
ç¬ã声ã¯ç¬ããŸãããããŒãžè§£ææéã¯350ããªç§ã«ççž®ãããŸããã ãŸããã³ã¡ã³ãã¯æ¬æ ŒçãªDOMèŠçŽ ã§ãããJavaScriptããã¢ã¯ã»ã¹ããŠãã®ã³ã³ãã³ããååŸã§ããŸãã
var elems = document .getElementById( 'content' ).childNodes;
for ( var i = 0, il = elems.length; i < il; i++) {
var el = elems[i];
if (el.nodeType == 8) { //comment
var div = document .createElement( 'div' );
div.innerHTML = el.nodeValue;
// div DOM-,
break ;
}
}
ããŒãžã解æããã³ãŒããããªãŒã«è§£æããããã®åèšæéã¯çŽ550ããªç§ã§ããïŒä»¥åã®ããŒãžã§ã³ã§ã¯800ããªç§ã§ããïŒã
ããŒãžãµã€ãºã®èšç®
ãã®ãããç« ã®å 容ãååŸããŠè§£æããç« ãããŒãžã«åå²ããå¿ èŠããããŸãã 解æã®æé©åäžã«ãããŒãžã¢ãŒãã®ç« ããŠã£ã³ããŠãšããŠããŒãžã³ã°ããã³ã³ãã³ãã移åããæåã®ããŒãžã§ã³ã«ã¯ãå€ãã®æ¬ ç¹ãããããšã«æ°ä»ããŸããã ãŸããç« å šäœãå šäœãšããŠè¡šç€ºïŒæç»ïŒããå¿ èŠããããŸããããã¯ããã§ã«ç解ããŠããããã«ãå€ãã®æéãããããŸãã 第äºã«ããã®ç¶æ³ã§ã¯ãç»é¢ã«è€æ°ã®ããŒãžã衚瀺ã§ããŸããã§ããïŒ2çªç®ã®ããŒãžã§ã¯ãç« å šäœãå®å šã«è€è£œããå¿ èŠããããŸãããããããŸãã倧ããªç« ã®ã¡ã¢ãªäžè¶³ã«ããé¿ããããªãã¢ããªã±ãŒã·ã§ã³ã¯ã©ãã·ã¥ã®åå ãšãªããŸãã
蚱容å¯èœãªã©ã³ã¿ã€ã ã§ããŒãžããŒã·ã§ã³ãäœæããããšããŠçŽ2ãæ倱æããåŸãããªãè¯ã解決çãèŠã€ãããŸããã èŠããã«ãããã¯äœã§ããã
æ¬è³ªçã«ãæ¬ã®ç« ã¯ãã©ã°ã©ãã®ã»ããã§ãã 段èœã¯ãæåã®ã¬ãã«ã®èŠçŽ ãšããŠè¡šãããšãã§ããŸãã iPhoneã§HTMLã³ã³ãã³ããã¬ã³ããªã³ã°ããé床ãèããŠã1ããŒãžãã§ããã ãæ©ã衚瀺ããã«ã¯ããã¬ãŒã³ããŒã·ã§ã³ã«å¿ èŠãªç¬¬1ã¬ãã«èŠçŽ ã®æå°ã»ããã決å®ããå¿ èŠããããŸãã ããŒãžã®ãªã¹ãã ãã§ãªãã第1ã¬ãã«ã®èŠçŽ ã®ãªã¹ããšãã圢ã§ç« å šäœãæã£ãŠããŸãã ããŒãžã¯ãæåã®ã¬ãã«ã®æåãšæåŸã®èŠçŽ ã®ã·ãªã¢ã«çªå·ããŠã£ã³ããŠã®ãµã€ãºãããã³ãªãã»ãããä¿åããããªããžã§ã¯ãã§ãã çµæã¯ããªãã³ã³ãã¯ãã§é«éãªãã¶ã€ã³ã§ããã1ããŒãžã衚瀺ããã«ã¯ãäžé£ã®ç¬¬1ã¬ãã«ã®èŠçŽ ãè€è£œããŠç»é¢ã«è¡šç€ºãããŠã£ã³ããŠã®æ£ãããªãã»ãããšãµã€ãºã瀺ããŸãã
ãã¹ãŠã®ããŒãžãèšç®ããã«ã¯ãæåã®ã¬ãã«ã®åèŠçŽ ã®å¯žæ³ãå éšããã³å€éšããŒãžã³ãå¢çç·ããã©ã³ããµã€ãºãªã©ãç¥ãå¿ èŠããããŸãã ãã®ããŒã¿ããã¹ãŠååŸããã«ã¯ãèŠçŽ ãããŒãžäžã«ãããã¹ã¿ã€ã«ããããã«é©çšãããŠããå¿ èŠããããŸãã ãããã®ç®çã®ããã«ãããŒãžèªäœã®ãã¹ãŠã®ã¹ã¿ã€ã«èšè¿°ãç¶æ¿ããç¹å¥ãªé ãã³ã³ãããŒãäœæããããã«æ®µèœãè¿œå ããŠèšç®ãå®è¡ããŸããã
èŠçŽ ã«å¿ èŠãªç¹æ§ãååŸããã«ã¯ããã®CSSããããã£ãåç §ããå¿ èŠããããŸãã åºç€ãšããŠãjQueryãã
css()
é¢æ°ãååŸããŸããã
function getCSS(elem, name) {
if (elem.style[name]) {
return elem.style[name];
} else {
var cs = window.getComputedStyle(elem, "" );
return cs && cs.getPropertyValue(name);
}
}
äžåºŠã«ããªãã®æ°ã®ããããã£ãååŸããå¿ èŠããã£ãããããã®æ©èœã¯ãWeb Inspectorã®ãããã¡ã€ã©ãŒã«ãã£ãŠå€æããŸããïŒãã¹ã¯ããããã©ãŠã¶ãŒãåç §ãããšãiPhoneã«ã¯ãã®ãããªãããã°ããŒã«ã¯ãªããäœæ¥ãå€§å¹ ã«è€éã«ããŸãïŒã
getComputedStyle()
ã
getComputedStyle()
åŒã³åºãã¯ããã©ãŒãã³ã¹ã®ç¹ã§éåžžã«é«äŸ¡ã§ãã ãããã£ãŠã99ïŒ ã®å ŽåãCSSããããã£ã¯
style
ãªããžã§ã¯ããä»ããŠèŠçŽ ã«å ¬éãããããã®æé©åã¯ããæ害ã§ãããããååŸããããããã£ã®é åãæäŸã§ããããã«ãã®é¢æ°ãå€æŽãã
elem.style[name]
ãã§ãã¯ãåé€ã
elem.style[name]
å©ããïŒ
function getCSS(elem, name) {
var names = ( typeof name == 'string' ) ? [name] : name,
cs = window.getComputedStyle(elem, "" ),
result = {};
for ( var i = 0, il = names.length; i < il; i++) {
var n = names[i];
result[n] = cs && cs.getPropertyValue(n);
}
return ( typeof name == 'string' ) ? result[name] : result;
}
ãã®ãããªæé©åã®åŸã
getCSS()
é¢æ°ã¯ãæãé ãé¢æ°ã®æåã®3ã€ã«ã該åœããŸããã§ãã:)ã
次ã®ã¹ãããïŒæéå ã®ããŒãžã®èšç®ãæ£ãããã¹ãã¢ãããŸãã å®éãJSã®å®è¡äžã¯ãã©ãŠã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãå®å šã«ãããã¯ãããã¹ã¯ãªããã®å®è¡æéã®å¶éãæå¹ã«ãªããŸãã ç»é¢ã20ã30ç§éãããªãŒãºãããå®è¡ã®ã¿ã€ã ã¢ãŠããè¶ éããŠããããšã瀺ããšã©ãŒã§å®å šã«èœã¡ããšããç¶æ³ãçºçããå¯èœæ§ããããŸãã Web Workersã¯ããã®ãããªåé¡ãåãé€ãããã®ææ°ã®æ¹æ³ã§ããã Mobile Safariã¯ãããããµããŒãããŠããŸããã ãããã£ãŠããã¹ãŠã®ãã©ãŠã¶ãŒã§åäœããå®èšŒæžã¿ã®ãgrandfatherãã¡ãœããã䜿çšããŸã
setTimeout()
ã䜿çšããŠããŒãžã«ãŠã³ãã®åå埩ãåŒã³åºããŸãã ãã®ãœãªã¥ãŒã·ã§ã³ã®ãµã³ãã«ã³ãŒãïŒ
function calculatePages(elems, callback) {
// elems â ,
var cur_elem = 0;
var run = function () {
createPage(elems[cur_elem]); //
cur_elem++;
if (cur_elem < elems.length)
setTimeout(run, 1);
else
callback(); //
};
run();
}
ãã®é¢æ°ã¯æ¬¡ã®ããã«æ©èœããŸãã ããšãã°ãæåã®ã¬ãã«ã®30åã®èŠçŽ ãã«ãŠã³ãããå¿ èŠããããŸãã ãããã®èŠçŽ ã®é åã
calculatePages()
é¢æ°ã«æž¡ããŸãããã®äžã«
run()
é¢æ°ã®åœ¢åŒã§ã¯ããŒãžã£ãŒãäœæãããŸããããã¯èšç®ã®1åã®ç¹°ãè¿ãã§ãã ã«ãŠã³ããçµäºããããé åå ã«ãŸã èŠçŽ ããããã©ããã確èªããŸãã ãã®å Žåã
setTimeout()
ä»ããŠæ°ããå埩
setTimeout()
åŒã³åºããŸãããã以å€ã®å Žåã¯ãã³ãŒã«ããã¯é¢æ°ãåŒã³åºããŠãèšç®ãçµäºããŠå ã«é²ãããšãã§ããããšãäŒããŸãã
ãã®ã¢ãããŒãã«ã¯1ã€ã®éèŠãªåŽé¢ããããŸã-1åã®å埩ã§ã®è² è·ã ãã®å Žåãããã¯
run()
é¢æ°ã®1åã®åŒã³åºãã§ã«ãŠã³ãããå¿ èŠãããèŠçŽ ã®æ°ã§ãã ããšãã°ã1åã®å埩ã§1ã€ã®èŠçŽ ãã«ãŠã³ããããå ŽåããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã¯å¯èœãªéãåå¿ããŸãããç« å šäœã®åèšèšç®æéã¯ãé¢æ°ã
setTimeout()
ä»ããŠèµ·åããããšãã«çºçãããªãŒããŒãããã®ããã«2ã3åå¢å ããå¯èœæ§ããããŸã 1åã®ãã¹ã§10åã®èŠçŽ ãã«ãŠã³ããããšãç« ã®åèšã«ãŠã³ãæéã¯æžå°ããŸãããã€ã³ã¿ãŒãã§ã€ã¹ã®å¿çæ§ãäœäžãã段èœãéåžžã«å€§ããå Žåã«ã¿ã€ã ã¢ãŠãããªããªã¹ã¯ãå¢å ããŸãã
ãããã£ãŠãèšç®æéãå€§å¹ ã«å¢å ãããã€ã³ã¿ãŒãã§ã€ã¹ã®å¿çæ§ãäœäžããªãããã«ãäžéç¹ãèŠã€ããå¿ èŠããããŸãã 第1ã¬ãã«ã®èŠçŽ ã®æ°ã§ã¯ãªãã
innerHTML
ãŸãã¯
textContent
ãéããŠååŸã§ããããªã¥ãŒã ã«
textContent
ã 5 KBã®å€ããè©Šè¡é¯èª€ã«ãã£ãŠãããå€ããªã¥ãŒã ãšããŠéžæãããŸããã
calculatePages()
åŒã³åºãåã«
calculatePages()
ãã¹ãŠã®ãªããžã§ã¯ããã°ã«ãŒãã«åããŸããã1ã€ã®ã°ã«ãŒãã®åèšããªã¥ãŒã ã5 KBãè¶ ãããšããã«éããããæ°ããã°ã«ãŒããäœæãããŸããã ãããã£ãŠãããŒãžãµã€ãºã®èšç®ã¯ãåã ã®èŠçŽ ã§ã¯ãªããã°ã«ãŒãã«ãã£ãŠå®è¡ãããŸããã
ã¢ã€ãã ãåé€ãã
1ã€ã®ã°ã«ãŒããã«ãŠã³ããããåŸãé衚瀺ã®ã³ã³ãããŒãã¯ãªã¢ãã次ã®èŠçŽ ã°ã«ãŒãã®ããã«ãªãœãŒã¹ã解æŸããå¿ èŠããããŸãã ã³ã³ããã®ã³ã³ãã³ããã¯ãªã¢ããæãç°¡åãªæ¹æ³ã¯ã
innerHTML
ããããã£ããªã»ããããããšã§ãã
function emptyElement(elem) {
elem.innerHTML = '' ;
}
ãã ãããæãåçŽãªããšã¯å¿ ããããæéããæå³ããããã§ã¯ãããŸãã-枬å®ã瀺ããããã«ããã®æ¹æ³ã¯ã¯ããã«é«éã«æ©èœããŸãã
function emptyElement(elem) {
while (elem.firstChild)
elem.removeChild(elem.firstChild);
}
ããããä»ã®ãšããã ãã®èšäºã§ã¯ãäœé»åããã€ã¹ã§å€§éã®ããŒã¿ã解æããã³èšç®ããæ©èœã®ããã€ãã調ã¹ãŸããã å®éã«ã¯ã説æãããã¹ãŠã®ããªãã¯ã¯éåžžã«å¹æçã§ããããšãå€æããŸããã ããšãã°ã1 MBãè¶ ããããªã¥ãŒã ã®ç« ããã¹ãããŸãããç§ãã¡ã®èªè ã¯30ã40ç§ã§ã©ããã§æ¶åã§ããŸããããObjective C / C ++ã§æžãããAppStoreã®ä»ã®ïŒéåžžã«äººæ°ã®ããïŒèªè ã¯åçŽã«èœã¡ãŸããã
次ã®èšäºã§ã¯ãiPhoneã§1ã€ã®ããŒãžãã¬ã³ããªã³ã°ããã®ã«ãããæéã«åœ±é¿ããããã€ãã®èŠå ãšããã®æéãå€§å¹ ã«ççž®ã§ããããªãã¯ãæ€èšããŸãã
ã»ã«ã²ã€ã»ãã¯ãšãã¯