Fix #2534: Don't pass a string argument to the XMLHttpRequest constructor.

This commit is contained in:
Philipp von Weitershausen
2012-09-05 00:09:18 -07:00
parent 1b14c035e7
commit ec59a626f2

View File

@@ -18,7 +18,10 @@ return unless window?
# Load a remote script from the current domain via XHR.
CoffeeScript.load = (url, callback) ->
xhr = new (window.ActiveXObject or XMLHttpRequest)('Microsoft.XMLHTTP')
if window.ActiveXObject
xhr = new window.ActiveXObject('Microsoft.XMLHTTP')
else
xhr = new XMLHttpRequest()
xhr.open 'GET', url, true
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onreadystatechange = ->