HTML5的表单到底还是不支持PUT、DELETE?

      REST架构的核心属性之一便是统一接口,可现在的HTML表单只支持GET和POST方法,一下子就“禁掉”(但是还是可以通过JavaScript脚本实现其它接口)了REST要求的一半接口。《RESTful Web Services》中很多例子都给form的method赋上了PUT、DELETE值,说是HTML5中会支持。于是我就好奇地搜了下HTML5在这方面的内容。

 

      在w3.org上的HTML5仓库里看到了一篇《HTML5 differences from HTML4》,是今年三月10号发布的草案。简单的用Ctrl-F搜了下“ form ”关键字,好像并没有提到改进了method方法,form的属性改动不少,但就是没有method啊……于是就疑惑了,难道用PUT和DELETE还得写JS?

 

文章发布得冲动了……刚才翻看了最新的HTML5草案,看到了这段话:

The method and formmethod content attributes are enumerated attributes with the following keywords and states:

  • The keyword GET, mapping to the state GET, indicating the HTTP GET method.
  • The keyword POST, mapping to the state POST, indicating the HTTP POST method.
  • The keyword PUT, mapping to the state PUT, indicating the HTTP PUT method.
  • The keyword DELETE, mapping to the state DELETE, indicating the HTTP DELETE method.

The missing value default for these attributes is the GET state.

The method of an element is one of those four states. If the element is a submit button and has a formmethod attribute, then the element's methodis that attribute's state; otherwise, it is the form owner's method attribute's state.

为什么那篇differences就不提呢……

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值