mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge pull request #3706 from imcotton/script-data-src
Optionally to read data-src out from <script>
This commit is contained in:
commit
0a3e3639dc
2 changed files with 7 additions and 5 deletions
|
@ -104,12 +104,13 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fn = function(script, i) {
|
fn = function(script, i) {
|
||||||
var options;
|
var options, source;
|
||||||
options = {
|
options = {
|
||||||
literate: script.type === coffeetypes[1]
|
literate: script.type === coffeetypes[1]
|
||||||
};
|
};
|
||||||
if (script.src) {
|
source = script.src || script.getAttribute('data-src');
|
||||||
return CoffeeScript.load(script.src, function(param) {
|
if (source) {
|
||||||
|
return CoffeeScript.load(source, function(param) {
|
||||||
coffees[i] = param;
|
coffees[i] = param;
|
||||||
return execute();
|
return execute();
|
||||||
}, options, true);
|
}, options, true);
|
||||||
|
|
|
@ -69,8 +69,9 @@ runScripts = ->
|
||||||
for script, i in coffees
|
for script, i in coffees
|
||||||
do (script, i) ->
|
do (script, i) ->
|
||||||
options = literate: script.type is coffeetypes[1]
|
options = literate: script.type is coffeetypes[1]
|
||||||
if script.src
|
source = script.src or script.getAttribute('data-src')
|
||||||
CoffeeScript.load script.src,
|
if source
|
||||||
|
CoffeeScript.load source,
|
||||||
(param) ->
|
(param) ->
|
||||||
coffees[i] = param
|
coffees[i] = param
|
||||||
execute()
|
execute()
|
||||||
|
|
Loading…
Add table
Reference in a new issue