2013-06-01から1ヶ月間の記事一覧

html文字列のあたまに空白があるとjQueryオブジェクトの作成に失敗する

var s = ' <div></div>'; console.log($($.trim(s))); console.log($(s)); // Uncaught Error: Syntax error, unrecognized expression: <div></div>

再帰的なtoJSON()

http://www.shesek.info/web-development/recursive-backbone-models-tojson Backbone.Model.prototype.toJSON = function() { if (this._isSerializing) { return this.id || this.cid; } this._isSerializing = true; var json = _.clone(this.attributes)…