Skip to content

Commit

Permalink
Fixes #21, fix test assertion name. Also update requirejs to 2.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jrburke committed Jul 23, 2013
1 parent 52c59e4 commit 4624ecb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
24 changes: 16 additions & 8 deletions impl/requirejs/require.js
@@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
Expand All @@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.6',
version = '2.1.8',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
Expand Down Expand Up @@ -1794,6 +1794,19 @@ var requirejs, require, define;
*/
req.onError = defaultOnError;

/**
* Creates the node for the load command. Only used in browser envs.
*/
req.createNode = function (config, moduleName, url) {
var node = config.xhtml ?
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
document.createElement('script');
node.type = config.scriptType || 'text/javascript';
node.charset = 'utf-8';
node.async = true;
return node;
};

/**
* Does the request to load a module for the browser case.
* Make this a separate function to allow other environments
Expand All @@ -1808,12 +1821,7 @@ var requirejs, require, define;
node;
if (isBrowser) {
//In the browser so use a script tag
node = config.xhtml ?
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
document.createElement('script');
node.type = config.scriptType || 'text/javascript';
node.charset = 'utf-8';
node.async = true;
node = req.createNode(config, moduleName, url);

node.setAttribute('data-requirecontext', context.contextName);
node.setAttribute('data-requiremodule', moduleName);
Expand Down
2 changes: 1 addition & 1 deletion server/manifest.js
Expand Up @@ -2,7 +2,7 @@
exports.manifest = {};

exports.manifest.requirejs = {
name: 'RequireJS @ 2.1.5',
name: 'RequireJS @ 2.1.8',
impl: 'requirejs/require.js',
config: 'requirejs/config.js'
};
Expand Down
6 changes: 3 additions & 3 deletions tests/basic_no_deps/_test.js
Expand Up @@ -3,9 +3,9 @@ go(["_reporter", "require"], function(amdJS, require) {
// tests if there are NO dependencies, the default
// values of "require, exports, module" are used
define('noDeps', function(require, exports, module) {
amdJS.assert(typeof(require) === 'function', 'basic_empty_deps: no dependencies case uses require in first slot. Is a function');
amdJS.assert(typeof(exports) === 'object', 'basic_empty_deps: no dependencies case uses exports in second slot. Is an object.');
amdJS.assert(typeof(module) === 'object', 'basic_empty_deps: no dependencies case uses module in third slot. Is an object.');
amdJS.assert(typeof(require) === 'function', 'basic_no_deps: no dependencies case uses require in first slot. Is a function');
amdJS.assert(typeof(exports) === 'object', 'basic_no_deps: no dependencies case uses exports in second slot. Is an object.');
amdJS.assert(typeof(module) === 'object', 'basic_no_deps: no dependencies case uses module in third slot. Is an object.');
});

window.setTimeout(function() {
Expand Down

0 comments on commit 4624ecb

Please sign in to comment.