Google Chrome ã§ã¯ã¦ãªã¹ã¿ã¼ã³ã¡ã³ãã®åºç¾ä½ç½®ããããã
åå 㯠Ten.js ã®ä»¥ä¸ã®ç®æ
getMousePosition: function(pos) { // pos should have clientX, clientY same as mouse event if ((navigator.userAgent.indexOf('Safari') > -1) && (navigator.userAgent.indexOf('Version/') < 0)) { return { x: pos.clientX, y: pos.clientY }; } else { var scroll = Ten.Geometry.getScroll(); return { x: pos.clientX + scroll.x, y: pos.clientY + scroll.y }; } },
ãã® if æã¯ã Safari 2 ç³»ãã©ãããè¦ã¦ãããã ãã 'Safari' ã¨ããæååããã£ã¦ 'Version/' ã¨ããæååããªããã©ãããå¤æåºæºã«ãã¦ãã¾ã£ã¦ããã
ããã¦ã Google Chrome ã«ã¯ Version/ ã¨ããæååãå«ã¾ãã¦ããªãï¼åã®ç°å¢ã§ã¯ï¼ã
ãªã®ã§ã Google Chrome = Safar 2 ç³»ã¨ããå¤å®ãããã¦ã event.client[XY] ãæå³ããªãå¤ã¨ãã¦æ±ãã
ããã¯ãããªãï¼ï¼
ã¬ã³ããªã³ã°ã¨ã³ã¸ã³ãè¦ãã¹ã
ãªã¼ãã³ã½ã¼ã¹ãªãã©ã¦ã¶ã§ã¯ããã©ã¦ã¶ã®ãã¼ã¸ã§ã³ã§å¤å®ãã¦ã¯ãããªãã
ã¬ã³ããªã³ã°ã¨ã³ã¸ã³ã®ãã¼ã¸ã§ã³ã§å¤å®ãã¹ãã ãï¼èªæãè¾¼ãã¦ï¼
ãªã®ã§ã Safari ã¨ããæåãè¦ã¦ã¯ãããªããããã¾ã§ã¬ã³ããªã³ã°ã¨ã³ã¸ã³ AppleWebKit ã¨ããæåãè¦ãã¹ãã
ãªã®ã§ã Safari 2 以åãã©ãããç¥ããããã°ä»¥ä¸ã®ããã«ããã®ãããã
var m; if ((m = navigator.userAgent.match(/AppleWebKit\/(\d+(\.\d+)?)/)) && m[1] < 500) { alert('Safari 2 Compat'); } else { alert('Modern'); }
ãã¼ã¸ã§ã³å¤å®ã¯ uai.js ãåèã«ãªã
http://homepage2.nifty.com/magicant/sjavascript/uai-spec.html
JavaScript-XPath ã§ããä¸è©±ã«ãªã£ã¦ãã¾ã
ãã¨
ãã®ä¾ã®å ´åã«éã£ã¦ã¯ã page[XY] ããã£ãããã£ã¡ä½¿ãã£ã¦å¤å®ãå ¥ãã¦ãããæ°ãããããã ãä¿å®æ§ã®åé¡ãã