Ruby's Louvre

每天学习一点点算法

导航

2010年12月16日 #

选择某元素内的文本

摘要: var autoSelect = function (el) { if (/textarea/i.test(el.tagName) || (/input/i.test(el.tagName) && /text/i.test(el.type))) { el.select(); } else if (!!window.getSelection) { // FF, Safari, Chrome, O... 阅读全文

posted @ 2010-12-16 23:35 司徒正美 阅读(908) 评论(1) 推荐(0) 编辑

How to Detect Font-Smoothing Using JavaScript

摘要: In an earlier article, I mentioned that Boing-Boing had a few issues when they wanted to use @font-face embedding inside their website. In short, the problem was that some fonts look bad on computer monitors without font-smoothing enabled in the operating system. This brought on a lot of discussio 阅读全文

posted @ 2010-12-16 23:29 司徒正美 阅读(1028) 评论(0) 推荐(0) 编辑

method_missing in JavaScript(SpiderMonkey)

摘要: ruby的method_missing魔法在JavaScript中是否有类似等价物?答案是SpiderMonkey的__noSuchMethod__ 方法。演示如下(请firebug大神出马): 总结: ruby:method_missingJavaScript(SpiderMonkey): __noSuchMethod__ (有可能会成为ECMAScript 3.1标准)smalltalk:doesNotUnderstandObjective-C:forward:: 阅读全文

posted @ 2010-12-16 23:27 司徒正美 阅读(916) 评论(0) 推荐(0) 编辑