小编Ton*_*Ton的帖子

什么是jQuery中使用的$(0)和$(1)?

在阅读以下性能测试时,我注意到作者使用过$(0)$(1).这样做的目的是什么?

http://jsperf.com/scriptjunkie-premature-3

var $a = $(0);

function fn_1() {
 var $a = $(this);
 if ($a.attr("rel") == "foo") {
  $a.addClass("foo");
 }
 else {
  $a.addClass("other");
 }
}

function fn_2() {
 $a.context = $a[0] = this; // fake the collection object
 if ($a.attr("rel") == "foo") {
  $a.addClass("foo");
 }
 else {
  $a.addClass("other");
 }
}
Run Code Online (Sandbox Code Playgroud)

jquery

9
推荐指数
1
解决办法
132
查看次数

GAE ProtoRPC是否支持请求的json数据字段

我正在开发python和GAE,

当我尝试使用ProtoRPC进行Web服务时,我找不到让我的请求在消息中包含json格式数据的方法.像这样的例子:

请求格式:

{"owner_id":"some id","jsondata":[{"name":"peter","dob":"1911-1-1","aaa":"sth str","xxx":sth int}, {"name":...}, ...]}'       
Run Code Online (Sandbox Code Playgroud)

蟒蛇:

class some_function_name(messages.Message):
owner_id = messages.StringField(1, required=True)
jsondata = messages.StringField(2, required=True)      #is there a json field instead of StringField?
Run Code Online (Sandbox Code Playgroud)

还有其他建议吗?

google-app-engine protorpc

3
推荐指数
1
解决办法
1684
查看次数

标签 统计

google-app-engine ×1

jquery ×1

protorpc ×1