dojo - Javascript (0 && 1) -
i'm trying debug javascript code related dojo localization, , came across following code in dojo:
isxd = function(mid, contextrequire){ return ( 0 && 1 ) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : true; },
what purpose of ternary operator here? seems me (0 && 1)
false
, function return true
. browser compatibility thing?
the source i've found differs bit code, explanation should fit.
the original code can found in i18n.js part of full source package:
isxd = function(mid, contextrequire){ return (has("dojo-sync-loader") && has("dojo-v1x-i18n-api")) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : true; },
the same part in i18n.js.uncompressed.js included in release package looks this:
isxd = function(mid, contextrequire){ return ( 1 && 1 ) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : true; },
when take @ the dojo loader section "options/features", you'll see dojo-sync-loader
has default value true
.
the documentation states:
the first column option/feature defined within loader, second options whether detected feature (via has.add()) or if option , default value. “unbuilt” source, features , options available. if loader has been built, of these features may have been set statichasfeatures , not configurable anymore.
as dojo-sync-loader
non-detectable feature, replaced in built source.
Comments
Post a Comment