25
PUT & DELETE why html form doesn’t support ? 2014/4/12

Why HTML Form dose not support PUT & DELETE ?

  • Upload
    jxck-

  • View
    5.857

  • Download
    2

Embed Size (px)

DESCRIPTION

Why HTML Form dosen't support PUT & DELETE ?

Citation preview

Page 1: Why HTML Form dose not support PUT & DELETE ?

PUT & DELETEwhy html form doesn’t support ?

2014/4/12

Page 2: Why HTML Form dose not support PUT & DELETE ?

Jack

● id: Jxck● github: Jxck● twitter: jxck_● about: http://jxck.io● blog: http://d.hatena.ne.jp/jxck● Love: music

Page 3: Why HTML Form dose not support PUT & DELETE ?

spec and status

Form

Page 4: Why HTML Form dose not support PUT & DELETE ?

form - method attr

<form

action="http://example.com/users"

method="post"><label for="name">name: </label>

<input type="text" id="name">

<input type="submit" value="send">

</form>

Page 5: Why HTML Form dose not support PUT & DELETE ?

I’m wondering...

https://twitter.com/Jxck_/status/447663659511054336

Page 6: Why HTML Form dose not support PUT & DELETE ?

Discussing on TL

http://togetter.com/li/646275

Page 7: Why HTML Form dose not support PUT & DELETE ?

History of Web... HTTP/0.91996/ 5 HTTP/1.0 (GET,POST,HEAD)1997/ 1 HTTP/1.1 (+ PUT,DELETE etc)1997/12 HTML 4.0 (GET,POST)1997/12 HTML 4.01 (GET,POST)2000/ 1 XHTML 1.02003/11 XForms 1.0 (GET,POST,PUT)2008/ 1 HTML 5 (GET,POST)2009/10 XForms 1.1 (+ DELETE)2010/11 XHTML 1.1...

Page 8: Why HTML Form dose not support PUT & DELETE ?

HTML 4.01 (spec)

method = get|post [CI]

This attribute specifies which HTTP method will be used to submit the form data set. Possible (case-insensitive) values are "get" (the default) and "post". See the section on form submission for usage information.

http://www.w3.org/TR/html401/interact/forms.html#adef-method

Page 9: Why HTML Form dose not support PUT & DELETE ?

HTML 4.0.x● Usage

○ before Ajax, XHR, REST○ “JavaScript off” on browser

● Security○ on Server Side○ apache case

■ http://www.apacheweek.com/features/put● Form Spec

○ action attr is static○ no header handling from form○ behavior for response

● No UseCases, No Needs

Page 10: Why HTML Form dose not support PUT & DELETE ?

History of Web... HTTP/0.91996/ 5 HTTP/1.0 (GET,POST,HEAD)1997/ 1 HTTP/1.1 (+ PUT,DELETE etc)1997/12 HTML 4.0 (GET,POST)1997/12 HTML 4.01 (GET,POST)2000/ 1 XHTML 1.02003/11 XForms 1.0 (GET,POST,PUT)2008/ 1 HTML 5 (GET,POST)2009/10 XForms 1.1 (+ DELETE)2010/11 XHTML 1.1...

Page 11: Why HTML Form dose not support PUT & DELETE ?

XForm 1.1 (spec)11.9.3 The put Submission Method

This submit method represents HTTP PUT or the equivalent concept (such as writing to a local file). The serialized form data is delivered as the message body.

11.9.4 The delete Submission Method

This submit method represents HTTP DELETE or the equivalent concept (such as deleting a local file). The serialized form data is delivered in the same manner as the getsubmission method (see 11.9.1 The get Submission Method).

http://www.w3.org/TR/2009/REC-xforms-20091020/#submit-put

Page 12: Why HTML Form dose not support PUT & DELETE ?

XForm● more rich Form by XML

○ lots of new feature○ no depends on JavaScript○ XForm 1.1 supports PUT, DELETE

● XHTML2.0 includes XForm○ finished working○ to HTML5○ no implementation

● XHTML2.0 Finished ;(

Page 13: Why HTML Form dose not support PUT & DELETE ?

History of Web... HTTP/0.91996/ 5 HTTP/1.0 (GET,POST,HEAD)1997/ 1 HTTP/1.1 (+ PUT,DELETE etc)1997/12 HTML 4.0 (GET,POST)1997/12 HTML 4.01 (GET,POST)2000/ 1 XHTML 1.02003/11 XForms 1.0 (GET,POST,PUT)2008/ 1 HTML 5 (GET,POST)2009/10 XForms 1.1 (+ DELETE)2010/11 XHTML 1.1...

Page 14: Why HTML Form dose not support PUT & DELETE ?

HTML 5 (spec)

http://www.w3.org/TR/html5/forms.html#attr-fs-method

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.

Page 15: Why HTML Form dose not support PUT & DELETE ?

HTML5● After Ajax, XHR, REST(like rails)● JavaScript has benefits● Discussion on @W3C bug 10671from Julian:

consider adding support for PUT and DELETE as form methods

from Chair:

"it doesn't make much sense with forms either" by Hixie

Page 16: Why HTML Form dose not support PUT & DELETE ?

it’s not period

But

Page 17: Why HTML Form dose not support PUT & DELETE ?

Continue in Public-HTML-Comments● Enhance http request generation from forms

○ https://www.w3.org/html/wg/tracker/issues/195○ long discussion

● HTML Form HTTP Extensions○ http://cameronjones.github.io/form-http-

extensions/index.html by Cameron Jones○ supports full HTTP/1.1 method○ supports HTTP Authenticate○ add payload attribute○ WIP now○ will WGFD and will be in HTML5.1?

Page 18: Why HTML Form dose not support PUT & DELETE ?

HTML Form HTTP Extensions

by Cameron Jones: http://cameronjones.github.io/form-http-extensions/index.html

Page 19: Why HTML Form dose not support PUT & DELETE ?

Example - PUT

<form action="http://www.example.com/cms/hogmanay" method="PUT">

<input name="If-Unmodified-Since"

type="hidden"

value="Tue, 1 Jan 2013 12:00:00 GMT"

payload="_header"/>

<textarea name="content">

// content

</textarea>

<button type="submit">Update</button>

</form>

Page 20: Why HTML Form dose not support PUT & DELETE ?

Example - Basic Auth Login

<form action="http://www.example.com/login" method="POST">

<label for="_username_">Username</label>

<input name="_username_" type="text"/>

<label for="_password_">Password</label>

<input name="_password_" type="password"/>

<button type="submit">Login</button>

</form>

Page 21: Why HTML Form dose not support PUT & DELETE ?

Example - Mail

<form action="mailto:">

<label for="to">To</label>

<input name="to" type="email" payload="_action"/>

<label for="cc">Cc</label>

<input name="cc" type="email" payload="_header"/>

<label for="subject">Subject</label>

<input name="subject" type="text" payload="_header"/>

<label>Content</label>

<textarea size="50"/>

<button type="submit">Send</button>

</form>

Page 22: Why HTML Form dose not support PUT & DELETE ?

Conclusion

Page 23: Why HTML Form dose not support PUT & DELETE ?

Conclusion● History

○ HTML4.x: No UseCase, No Needs○ XForm: XHTML2.0 Finished○ HTML5: Make No Sence

● Draft○ Discussing Now

○ Extend Form SPEC by Cameron

○ http://cameronjones.github.io/form-http-extensions/index.html

○ Will include in HTML5.1 ?

Page 25: Why HTML Form dose not support PUT & DELETE ?

thanks :)

END