Comparing version 1.10.0 to 1.10.1
@@ -177,2 +177,3 @@ define(["../has", "require"], function(has, require){ | ||
}; | ||
var global = (function () { return this; })(); | ||
result = has("dojo-loader") ? | ||
@@ -182,3 +183,3 @@ // must be a built version of the dojo loader; all config stuffed in require.rawConfig | ||
// a foreign loader | ||
this.dojoConfig || this.djConfig || {}; | ||
global.dojoConfig || global.djConfig || {}; | ||
adviseHas(result, "config", 1); | ||
@@ -185,0 +186,0 @@ adviseHas(result.has, "", 1); |
@@ -13,2 +13,3 @@ define(["../has", "./config", "require", "module"], function(has, config, require, module){ | ||
// FIXME: in 2.0 remove dijit, dojox being created by dojo | ||
global = (function () { return this; })(), | ||
dijit = {}, | ||
@@ -22,3 +23,3 @@ dojox = {}, | ||
config:config, | ||
global:this, | ||
global:global, | ||
dijit:dijit, | ||
@@ -72,3 +73,3 @@ dojox:dojox | ||
if(!config.noGlobals){ | ||
this[item[0]] = item[1]; | ||
global[item[0]] = item[1]; | ||
} | ||
@@ -85,3 +86,3 @@ } | ||
var rev = "$Rev: e124479 $".match(/[0-9a-f]{7,}/); | ||
var rev = "$Rev: 2bde291 $".match(/[0-9a-f]{7,}/); | ||
dojo.version = { | ||
@@ -99,3 +100,3 @@ // summary: | ||
major: 1, minor: 10, patch: 0, flag: "", | ||
major: 1, minor: 10, patch: 1, flag: "", | ||
revision: rev ? rev[0] : NaN, | ||
@@ -102,0 +103,0 @@ toString: function(){ |
@@ -21,3 +21,3 @@ define(["./kernel", "./lang", "../sniff"], function(dojo, lang, has){ | ||
doc: this["document"] || null, | ||
doc: dojo.global["document"] || null, | ||
/*===== | ||
@@ -24,0 +24,0 @@ doc: { |
@@ -234,7 +234,7 @@ define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./dom-attr"], | ||
// | ||
// Attributes are set by passing the optional object through `dojo.setAttr`. | ||
// See `dojo.setAttr` for noted caveats and nuances, and API if applicable. | ||
// Attributes are set by passing the optional object through `dojo/dom-attr.set`. | ||
// See `dojo/dom-attr.set` for noted caveats and nuances, and API if applicable. | ||
// | ||
// Placement is done via `dojo.place`, assuming the new node to be the action | ||
// node, passing along the optional reference node and position. | ||
// Placement is done via `dojo/dom-construct.place`, assuming the new node to be | ||
// the action node, passing along the optional reference node and position. | ||
// tag: DOMNode|String | ||
@@ -246,9 +246,9 @@ // A string of the element to create (eg: "div", "a", "p", "li", "script", "br"), | ||
// Can be null, if you don't want to set any attributes/styles. | ||
// See: `dojo.setAttr` for a description of available attributes. | ||
// See: `dojo/dom-attr.set` for a description of available attributes. | ||
// refNode: DOMNode|String? | ||
// Optional reference node. Used by `dojo.place` to place the newly created | ||
// Optional reference node. Used by `dojo/dom-construct.place` to place the newly created | ||
// node somewhere in the dom relative to refNode. Can be a DomNode reference | ||
// or String ID of a node. | ||
// pos: String? | ||
// Optional positional reference. Defaults to "last" by way of `dojo.place`, | ||
// Optional positional reference. Defaults to "last" by way of `dojo/domConstruct.place`, | ||
// though can be set to "first","after","before","last", "replace" or "only" | ||
@@ -271,4 +271,4 @@ // to further control the placement of the new node relative to the refNode. | ||
// Place a new DIV in the BODY, with no attributes set | ||
// | require(["dojo/dom-construct"], function(domConstruct){ | ||
// | var n = domConstruct.create("div", null, dojo.body()); | ||
// | require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){ | ||
// | var n = domConstruct.create("div", null, win.body()); | ||
// | }); | ||
@@ -290,4 +290,4 @@ // | ||
// Create an anchor, with an href. Place in BODY: | ||
// | require(["dojo/dom-construct"], function(domConstruct){ | ||
// | domConstruct.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body()); | ||
// | require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){ | ||
// | domConstruct.create("a", { href:"foo.html", title:"Goto FOO!" }, win.body()); | ||
// | }); | ||
@@ -294,0 +294,0 @@ |
define(['./has'], function(has){ | ||
var global = this, | ||
var global = (function () { return this; })(), | ||
doc = document, | ||
@@ -42,3 +42,3 @@ readyStates = { 'loaded': 1, 'complete': 1 }, | ||
}catch(err){ | ||
console.log("Error on domReady callback: " + err); | ||
console.error(err, "in domReady callback", err.stack); | ||
} | ||
@@ -45,0 +45,0 @@ } |
@@ -29,3 +29,3 @@ define(["require", "module"], function(require, module){ | ||
// has API variables | ||
global = this, | ||
global = (function () { return this; })(), | ||
doc = isBrowser && document, | ||
@@ -32,0 +32,0 @@ element = doc && doc.createElement("DiV"), |
90
node.js
@@ -1,17 +0,16 @@ | ||
define(["./has"], function(has){ | ||
if(!has("host-node")){ | ||
throw new Error("node plugin failed to load because environment is not Node.js"); | ||
} | ||
define(["./_base/kernel", "./has", "require"], function(kernel, has, require){ | ||
var nodeRequire = kernel.global.require && kernel.global.require.nodeRequire; | ||
var pathUtil; | ||
if(require.nodeRequire){ | ||
pathUtil = require.nodeRequire("path"); | ||
}else{ | ||
throw new Error("node plugin failed to load because it cannot find the original Node.js require"); | ||
if (!nodeRequire) { | ||
throw new Error("Cannot find the Node.js require"); | ||
} | ||
var module = nodeRequire("module"); | ||
return { | ||
// summary: | ||
// This AMD plugin module allows native Node.js modules to be loaded by AMD modules using the Dojo | ||
// loader. Note that this plugin will not work with AMD loaders other than the Dojo loader. | ||
// loader. This plugin will not work with AMD loaders that do not expose the Node.js require function | ||
// at `require.nodeRequire`. | ||
// | ||
// example: | ||
@@ -22,27 +21,40 @@ // | require(["dojo/node!fs"], function(fs){ | ||
load: function(/*string*/ id, /*Function*/ require, /*Function*/ load){ | ||
// summary: | ||
// Standard AMD plugin interface. See https://github.com/amdjs/amdjs-api/wiki/Loader-Plugins | ||
// for information. | ||
load: function(/*string*/ id, /*Function*/ contextRequire, /*Function*/ load){ | ||
/*global define:true */ | ||
if(!require.nodeRequire){ | ||
throw new Error("Cannot find native require function"); | ||
// The `nodeRequire` function comes from the Node.js module of the AMD loader, so module ID resolution is | ||
// relative to the loader's path, not the calling AMD module's path. This means that loading Node.js | ||
// modules that exist in a higher level or sibling path to the loader will cause those modules to fail to | ||
// resolve. | ||
// | ||
// Node.js does not expose a public API for performing module filename resolution relative to an arbitrary | ||
// directory root, so we are forced to dig into the internal functions of the Node.js `module` module to | ||
// use Node.js's own path resolution code instead of having to duplicate its rules ourselves. | ||
// | ||
// Sooner or later, probably around the time that Node.js internal code is reworked to use ES6, these | ||
// methods will no longer be exposed and we will have to find another workaround if they have not exposed | ||
// an API for doing this by then. | ||
if(module._findPath && module._nodeModulePaths){ | ||
var localModulePath = module._findPath(id, module._nodeModulePaths(contextRequire.toUrl("."))); | ||
if (localModulePath !== false) { | ||
id = localModulePath; | ||
} | ||
} | ||
load((function(id, require){ | ||
var oldDefine = define, | ||
result; | ||
var oldDefine = define, | ||
result; | ||
// Some modules may attempt to detect an AMD loader via define and define.amd. This can cause issues | ||
// when other CommonJS modules attempt to load them via the standard node require(). If define is | ||
// temporarily moved into another variable, it will prevent modules from detecting AMD in this fashion. | ||
define = undefined; | ||
// Some modules attempt to detect an AMD loader by looking for global AMD `define`. This causes issues | ||
// when other CommonJS modules attempt to load them via the standard Node.js `require`, so hide it | ||
// during the load | ||
define = undefined; | ||
try{ | ||
result = require(id); | ||
}finally{ | ||
define = oldDefine; | ||
} | ||
return result; | ||
})(id, require.nodeRequire)); | ||
try { | ||
result = nodeRequire(id); | ||
} | ||
finally { | ||
define = oldDefine; | ||
} | ||
load(result); | ||
}, | ||
@@ -52,13 +64,11 @@ | ||
// summary: | ||
// Produces a normalized id to be used by node. Relative ids are resolved relative to the requesting | ||
// module's location in the file system and will return an id with path separators appropriate for the | ||
// local file system. | ||
// Produces a normalized CommonJS module ID to be used by Node.js `require`. Relative IDs | ||
// are resolved relative to the requesting module's location in the filesystem and will | ||
// return an ID with path separators appropriate for the local filesystem | ||
if(id.charAt(0) === "."){ | ||
// dirname of the reference module - normalized to match the local file system | ||
var referenceModuleDirname = require.toUrl(normalize(".")).replace("/", pathUtil.sep), | ||
segments = id.split("/"); | ||
segments.unshift(referenceModuleDirname); | ||
// this will produce an absolute path normalized to the semantics of the underlying file system. | ||
id = pathUtil.join.apply(pathUtil, segments); | ||
if (id.charAt(0) === ".") { | ||
// absolute module IDs need to be generated based on the AMD loader's knowledge of the parent module, | ||
// since Node.js will try to use the directory containing `dojo.js` as the relative root if a | ||
// relative module ID is provided | ||
id = require.toUrl(normalize("./" + id)); | ||
} | ||
@@ -65,0 +75,0 @@ |
50
on.js
@@ -12,2 +12,26 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], function(aspect, dojo, has){ | ||
}); | ||
if(has("touch")){ | ||
has.add("touch-can-modify-event-delegate", function(){ | ||
// This feature test checks whether deleting a property of an event delegate works | ||
// for a touch-enabled device. If it works, event delegation can be used as fallback | ||
// for browsers such as Safari in older iOS where deleting properties of the original | ||
// event does not work. | ||
var EventDelegate = function(){}; | ||
EventDelegate.prototype = | ||
document.createEvent("MouseEvents"); // original event | ||
// Attempt to modify a property of an event delegate and check if | ||
// it succeeds. Depending on browsers and on whether dojo/on's | ||
// strict mode is stripped in a Dojo build, there are 3 known behaviors: | ||
// it may either succeed, or raise an error, or fail to set the property | ||
// without raising an error. | ||
try{ | ||
var eventDelegate = new EventDelegate; | ||
eventDelegate.target = null; | ||
return eventDelegate.target === null; | ||
}catch(e){ | ||
return false; // cannot use event delegation | ||
} | ||
}); | ||
} | ||
} | ||
@@ -236,3 +260,5 @@ var on = function(target, type, listener, dontFix){ | ||
// if it matches we call the listener | ||
return eventTarget && listener.call(eventTarget, event); | ||
if (eventTarget) { | ||
return listener.call(eventTarget, event); | ||
} | ||
}); | ||
@@ -500,3 +526,3 @@ }; | ||
if(has("touch")){ | ||
var Event = function(){}; | ||
var EventDelegate = function(){}; | ||
var windowOrientation = window.orientation; | ||
@@ -515,16 +541,18 @@ var fixTouchListener = function(listener){ | ||
try{ | ||
delete originalEvent.type; // on some JS engines (android), deleting properties make them mutable | ||
delete originalEvent.type; // on some JS engines (android), deleting properties makes them mutable | ||
}catch(e){} | ||
if(originalEvent.type){ | ||
// deleting properties doesn't work (older iOS), have to use delegation | ||
if(has('mozilla')){ | ||
// Firefox doesn't like delegated properties, so we have to copy | ||
var event = {}; | ||
// Deleting the property of the original event did not work (this is the case of | ||
// browsers such as older Safari iOS), hence fallback: | ||
if(has("touch-can-modify-event-delegate")){ | ||
// If deleting properties of delegated event works, use event delegation: | ||
EventDelegate.prototype = originalEvent; | ||
event = new EventDelegate; | ||
}else{ | ||
// Otherwise last fallback: other browsers, such as mobile Firefox, do not like | ||
// delegated properties, so we have to copy | ||
event = {}; | ||
for(var name in originalEvent){ | ||
event[name] = originalEvent[name]; | ||
} | ||
}else{ | ||
// old iOS branch | ||
Event.prototype = originalEvent; | ||
var event = new Event; | ||
} | ||
@@ -531,0 +559,0 @@ // have to delegate methods to make them work |
{ | ||
"name": "dojo", | ||
"version":"1.10.0", | ||
"version":"1.10.1", | ||
"directories": { | ||
@@ -5,0 +5,0 @@ "lib": "." |
@@ -65,2 +65,6 @@ define([ | ||
var handleNativeResponse = function(response) { | ||
if(!has('native-xhr2-blob') && response.options.handleAs === 'blob' && typeof Blob !== 'undefined'){ | ||
return new Blob([ response.xhr.response ], { type: response.xhr.getResponseHeader('Content-Type') }); | ||
} | ||
return response.xhr.response; | ||
@@ -67,0 +71,0 @@ } |
@@ -182,3 +182,3 @@ define([ | ||
parentNode = parentNode.parentNode; | ||
}while(parentNode !== win.doc.documentElement); | ||
}while(parentNode && parentNode !== win.doc.documentElement); | ||
@@ -185,0 +185,0 @@ // Append the form node or some browsers won't work |
@@ -5,2 +5,3 @@ define([ | ||
'./util', | ||
'../_base/kernel', | ||
'../_base/array', | ||
@@ -15,3 +16,3 @@ '../_base/lang', | ||
'../_base/declare' =====*/ | ||
], function(module, watch, util, array, lang, on, dom, domConstruct, has, win/*=====, request, declare =====*/){ | ||
], function(module, watch, util, kernel, array, lang, on, dom, domConstruct, has, win/*=====, request, declare =====*/){ | ||
has.add('script-readystatechange', function(global, document){ | ||
@@ -27,3 +28,3 @@ var script = document.createElement('script'); | ||
readyRegExp = /complete|loaded/, | ||
callbacks = this[mid + '_callbacks'] = {}, | ||
callbacks = kernel.global[mid + '_callbacks'] = {}, | ||
deadScripts = []; | ||
@@ -30,0 +31,0 @@ |
@@ -34,5 +34,20 @@ define([ | ||
has.add('native-xhr2-blob', function(){ | ||
if(!has('native-response-type')){ return; } | ||
var x = new XMLHttpRequest(); | ||
x.open('GET', '/', true); | ||
x.responseType = 'blob'; | ||
// will not be set if unsupported | ||
var responseType = x.responseType; | ||
x.abort(); | ||
return responseType === 'blob'; | ||
}); | ||
// Google Chrome doesn't support "json" response type | ||
// up to version 30, so it's intentionally not included here | ||
var nativeResponseTypes = {'blob': 1, 'document': 1, 'arraybuffer': 1}; | ||
var nativeResponseTypes = { | ||
'blob': has('native-xhr2-blob') ? 'blob' : 'arraybuffer', | ||
'document': 'document', | ||
'arraybuffer': 'arraybuffer' | ||
}; | ||
@@ -201,3 +216,3 @@ function handleResponse(response, error){ | ||
if(has('native-response-type') && options.handleAs in nativeResponseTypes) { | ||
_xhr.responseType = options.handleAs; | ||
_xhr.responseType = nativeResponseTypes[options.handleAs]; | ||
} | ||
@@ -204,0 +219,0 @@ |
@@ -420,2 +420,11 @@ define([ | ||
t.is(testValue, 3); | ||
}, | ||
function delegatePreventDefault(t){ | ||
var div = document.createElement("div"); | ||
div.innerHTML = '<input type="checkbox">'; | ||
var cb = div.childNodes[0]; | ||
document.body.appendChild(div); | ||
on(div, '.matchesNothing:click', function () {}); | ||
cb.click(); | ||
t.t(cb.checked); | ||
} | ||
@@ -422,0 +431,0 @@ ]); |
@@ -170,5 +170,5 @@ define(["./_base/lang", "./sniff", "./_base/window", "./dom", "./dom-geometry", "./dom-style", "./dom-construct"], | ||
elPos.w = rootWidth; elPos.h = rootHeight; | ||
if(scrollRoot == html && isIE && rtl){ elPos.x += scrollRoot.offsetWidth-elPos.w; } // IE workaround where scrollbar causes negative x | ||
if(elPos.x < 0 || !isIE || isIE >= 9){ elPos.x = 0; } // older IE can have values > 0 | ||
if(elPos.y < 0 || !isIE || isIE >= 9){ elPos.y = 0; } | ||
if(scrollRoot == html && (isIE || has("trident")) && rtl){ elPos.x += scrollRoot.offsetWidth-elPos.w; } // IE workaround where scrollbar causes negative x | ||
if(elPos.x < 0 || !isIE || isIE >= 9 || has("trident")){ elPos.x = 0; } // older IE can have values > 0 | ||
if(elPos.y < 0 || !isIE || isIE >= 9 || has("trident")){ elPos.y = 0; } | ||
}else{ | ||
@@ -214,3 +214,3 @@ var pb = geom.getPadBorderExtents(el); | ||
s = Math[l < 0? "max" : "min"](l, r); | ||
if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9)){ s = -s; } | ||
if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9 || has("trident"))){ s = -s; } | ||
old = el.scrollLeft; | ||
@@ -217,0 +217,0 @@ scrollElementBy(el, s, 0); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4223957
116106
78