Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

xmlhttprequest level 2 support #385

Closed
aeosynth opened this Issue · 10 comments

3 participants

@aeosynth

https://github.com/Modernizr/Modernizr/blob/master/test/caniuse.html#L728-730

var progEv = !!(window.ProgressEvent);
var fdata = !!(window.FormData);
setResult('xhr20', (progEv && fdata));
@paulirish
Owner

i've seen other XHR2 tests that just look for 'WithCredentials in window.XMLHTTPRequest`

can you look into which is best?
also can you link up the spec pretty plz :)

@aeosynth

can you look into which is best?

define best. theoretically all of the added features should be checked:

http://www.w3.org/TR/XMLHttpRequest2/#differences

Differences from XMLHttpRequest

XMLHttpRequest Level 2 adds the following new features:

  • The ability to make cross-origin requests.

  • The ability to make anonymous requests — Referer, origin, and credentials are not part of the request.

  • The ability to register for progress events. Both for downloads (put listeners on the XMLHttpRequest object itself) and uploads (put listeners on the XMLHttpRequestUpload object, returned by the upload attribute).

  • The ability to override the media type and character encoding of the response through the overrideMimeType() method.

  • The ability to set a timeout for the request.

  • The ability to transfer ArrayBuffer, Blob, File and FormData objects.

  • The responseType and response attributes.

@paulirish
Owner

welllll..
ideally we see if there is a heuristic which is indicative of all those.. or at least all those features that you'd care about.

it's a bit of an inference but that's kinda what we gotta do.. otherwise we're doing conformance testing against the spec.

@paulirish
Owner

trying this on testling...

@paulirish
Owner

just tested everything and if a browser supports one of the 3 it supports ALL of them.
EXCEPT for Opera Next.. which supports WithCredentials and FormData but not ProgressEvent so........

shrug

@paulirish
Owner

we need a network-xhr2.js for feature-detects/

and hopefully by the time opera 12 ships they have ProgressEvent

which means we can just ask for one of these..

btw my gist.. https://gist.github.com/1431660#file_xhr2.js and results in a comment blow.

@paulirish
Owner

thx for reporting! wooo

https://gist.github.com/1431660#file_xhr2.js

we can use any three of those as an XHR2 test now. PRs accepted!

@paulirish
Owner

fixed!

@paulirish paulirish closed this in 22912a1
@phistuck phistuck referenced this issue from a commit
@phistuck phistuck xhr2 test. fixes #385 18ecf42
@patrickkettner patrickkettner referenced this issue from a commit in patrickkettner/Modernizr
@paulirish paulirish xhr2 test. fixes #385 68ab135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.