Category Archives: Skill | 技術
為什麼 CSS 選擇器是從右往左的?
很多人可能都知道了 CSS 的選擇器瀏覽器在解析的時候是從右往左的,和你所熟悉的從左往右的規則是不同的。但是這是為什麼呢?這麼做的性能是否更高? Related Items: 為什麼排版引擎解析 CSS 選擇器時一定要從右往左解析?
野比のび太あなごの頭
New Nobita Anago avatar, by @iiiCyan. 最近很流行的鰻魚頭像,最早先是看到了重光同學 @lucifierya 的坂田銀時的鰻魚頭像。 鰻魚作者是 @daijingogo。以及官方出品的鰻魚頭像製作器 http://anago.crap.jp/ 另外還有One Piece的鰻魚頭像 http://youkocleo.exteen.com/ Have fun!
a snippet for testing whether you could visit twtter or facebook
Some of you guys like add “Twitter button” or “Facebook Like button” on your website. But if your visitor from china that don’t use VPN or anyother jailbreak the G-F-W tools, it will slow down the page load until the … Continue reading
匹配一段文本中URL的正則問題
在項目中有個這樣的設計,備註中的URL自動識別為點擊的鏈接,對此的處理方式是用正則匹配出URL部分,然後替換成<a href=URL>URL這樣即可。其主要部分是正則匹配出URL部分。 假設有這麼一段文本。 你好,我是一段文本。我鏈接到http://leeiio.me/test.html請大家多多指教。 那麼我們可以這麼寫。 var text = "你好,我是一段文本。我鏈接到http://leeiio.me/test.html請大家多多指教。"; var regexp = /((http|ftp|https|file):\/\/([\w\-]+\.)+[\w\-]+(\/[\w\-\.\/?\@\%\!\&=\+\~\:\#\;\,]*)?)/ig; text = text.replace(regexp,"<a href=’$1′>$1</a>"); console.log(text);var text = "你好,我是一段文本。我鏈接到http://leeiio.me/test.html請大家多多指教。"; var regexp = /((http|ftp|https|file):\/\/([\w\-]+\.)+[\w\-]+(\/[\w\-\.\/?\@\%\!\&=\+\~\:\#\;\,]*)?)/ig; text = text.replace(regexp,"<a href=’$1′>$1</a>"); console.log(text); 但是如果URL中帶有中文,那麼以上的就不頂事了。
The Difference Between jQuery』s .bind(), .live(), and .delegate()
西方不夠好的朋友可以看這篇譯文《jQuery的.bind()、.live()和.delegate()之間的區別》。這篇文章詳細的比較了bind(),live()以及delegate()的區別。以及作者為什麼推薦用delegate()。