Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Mon, 03 Mar 2014 13:30:10 -0500
changeset 2132 735083b40389
parent 2131 cdd188f1d6f2
child 2133 0fa07d98cd8f
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Mon Mar 03 09:32:49 2014 -0500
+++ b/playground/jsonld.js	Mon Mar 03 13:30:10 2014 -0500
@@ -529,7 +529,7 @@
     var frame = remoteFrame.document;
     var ctx;
     if(frame) {
-      ctx = frame['@context'] || {};
+      ctx = frame['@context'];
       if(remoteFrame.contextUrl) {
         if(!ctx) {
           ctx = remoteFrame.contextUrl;
@@ -542,6 +542,9 @@
         }
         frame['@context'] = ctx;
       }
+      else {
+        ctx = ctx || {};
+      }
     }
     else {
       ctx = {};
@@ -1044,7 +1047,7 @@
  */
 jsonld.promisify = function(op) {
   try {
-    var Promise = global.Promise || require('./Promise').Promise;
+    var Promise = global.Promise || require('es6-promise').Promise;
   }
   catch(e) {
     throw new Error('Unable to find a Promise implementation.');
@@ -1122,7 +1125,7 @@
   if(typeof setImmediate === 'function') {
     jsonld.setImmediate = jsonld.nextTick = function(callback) {
       return setImmediate(callback);
-    }
+    };
   }
   else {
     jsonld.setImmediate = function(callback) {
@@ -1603,8 +1606,7 @@
 
   // retrieve URLs in localCtx
   localCtx = _clone(localCtx);
-  if(_isString(localCtx) ||
-    (_isObject(localCtx) && !('@context' in localCtx))) {
+  if(!(_isObject(localCtx) && '@context' in localCtx)) {
     localCtx = {'@context': localCtx};
   }
   _retrieveContextUrls(localCtx, options, function(err, ctx) {
@@ -5767,7 +5769,7 @@
 }
 
 /**
- * Retrieves external @context URLs using the given context loader. Every
+ * Retrieves external @context URLs using the given document loader. Every
  * instance of @context in the input that refers to a URL will be replaced
  * with the JSON @context found at that URL.
  *