首先,是否有拼写错误?
在 HTML
靠前的位置使用 script
标签初始化 JS 变量,不要使用 <input type="hidden" name="id" id="id" value="${id}" />
/** | |
* 把数组填充到字符串内 | |
* @param {Array} array | |
* @param {Function} fn | |
* @return {String} | |
*/ | |
function each(array, fn){ | |
var s = '', l = array.length; | |
for (var i = 0; i < l; i++) { | |
if (typeof array[i] != 'undefined'){ |
#iOS
Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12F70 QQ/5.7.0.469 NetType/WIFI Mem/673
Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12F70 MicroMessenger/6.2.3 NetType/WIFI Language/zh_CN
/* | |
* Less compiler with --watch and --smartpath support | |
* | |
* Based on lessc of less 1.3.0 | |
* | |
* Added options: | |
* | |
* -w, --watch Watch files (include @import files) for changes and re-compile | |
* | |
* -m, --smartpath output css file like this: |
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus | |
less2stylus = (string) -> | |
string = string | |
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through) | |
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets | |
.replace(/\;\ *?$/gm, "") # remove semicolons | |
.replace(/@(\w+):(\ *)\ /g, (_, $1, $2) -> # replace @variable: with $variable = | |
"$#{$1}#{$2} = " |
Related: [Why you don't need jQuery as an abstraction][2]
$
itself is a god object. Everything goes on it. The standard plugin / extension architecture that is recommended is to just bolt more methods on $
itself!
Surely this is bad. An example would be how we have both $.load
which is overloaded to do completely different things. If they were on two separate sensibly named objects $Container.load
and $EventTarget.load
. Personally I would deprecate the latter in favour of .on('load'
The animation should be it's own little modular thing, not bolted onto $
. Ajax should be it's own little modular thing, not bolted onto $
var stackSize = 0; | |
function foo(a, stackSize){ | |
stackSize ++; | |
bar(); | |
if (!a.length) return; | |
if (stackSize > 1000) { |
//缩进两个空格 | |
var a = 1 | |
, b = 2 | |
, c = 3 | |
, d = { | |
e: 4 | |
, f: 5 | |
, g: 6 | |
} | |
, h = [ |