mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge pull request #2851 from toots/master
More explicit window context.
This commit is contained in:
commit
57d3cfd67f
2 changed files with 8 additions and 8 deletions
|
@ -51,7 +51,7 @@
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
options.sourceFiles = [url];
|
options.sourceFiles = [url];
|
||||||
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
|
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
if ('overrideMimeType' in xhr) {
|
if ('overrideMimeType' in xhr) {
|
||||||
xhr.overrideMimeType('text/plain');
|
xhr.overrideMimeType('text/plain');
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
|
|
||||||
runScripts = function() {
|
runScripts = function() {
|
||||||
var coffees, coffeetypes, execute, index, length, s, scripts;
|
var coffees, coffeetypes, execute, index, length, s, scripts;
|
||||||
scripts = document.getElementsByTagName('script');
|
scripts = window.document.getElementsByTagName('script');
|
||||||
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
|
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
|
||||||
coffees = (function() {
|
coffees = (function() {
|
||||||
var _i, _len, _ref, _results;
|
var _i, _len, _ref, _results;
|
||||||
|
@ -110,9 +110,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window.addEventListener) {
|
if (window.addEventListener) {
|
||||||
addEventListener('DOMContentLoaded', runScripts, false);
|
window.addEventListener('DOMContentLoaded', runScripts, false);
|
||||||
} else {
|
} else {
|
||||||
attachEvent('onload', runScripts);
|
window.attachEvent('onload', runScripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -35,7 +35,7 @@ CoffeeScript.load = (url, callback, options = {}) ->
|
||||||
xhr = if window.ActiveXObject
|
xhr = if window.ActiveXObject
|
||||||
new window.ActiveXObject('Microsoft.XMLHTTP')
|
new window.ActiveXObject('Microsoft.XMLHTTP')
|
||||||
else
|
else
|
||||||
new XMLHttpRequest()
|
new window.XMLHttpRequest()
|
||||||
xhr.open 'GET', url, true
|
xhr.open 'GET', url, true
|
||||||
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
|
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
|
||||||
xhr.onreadystatechange = ->
|
xhr.onreadystatechange = ->
|
||||||
|
@ -51,7 +51,7 @@ CoffeeScript.load = (url, callback, options = {}) ->
|
||||||
# all script tags with a content-type of `text/coffeescript`.
|
# all script tags with a content-type of `text/coffeescript`.
|
||||||
# This happens on page load.
|
# This happens on page load.
|
||||||
runScripts = ->
|
runScripts = ->
|
||||||
scripts = document.getElementsByTagName 'script'
|
scripts = window.document.getElementsByTagName 'script'
|
||||||
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
|
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
|
||||||
coffees = (s for s in scripts when s.type in coffeetypes)
|
coffees = (s for s in scripts when s.type in coffeetypes)
|
||||||
index = 0
|
index = 0
|
||||||
|
@ -71,6 +71,6 @@ runScripts = ->
|
||||||
|
|
||||||
# Listen for window load, both in decent browsers and in IE.
|
# Listen for window load, both in decent browsers and in IE.
|
||||||
if window.addEventListener
|
if window.addEventListener
|
||||||
addEventListener 'DOMContentLoaded', runScripts, no
|
window.addEventListener 'DOMContentLoaded', runScripts, no
|
||||||
else
|
else
|
||||||
attachEvent 'onload', runScripts
|
window.attachEvent 'onload', runScripts
|
||||||
|
|
Loading…
Reference in a new issue