Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Thu, 28 Feb 2013 16:51:40 -0500
changeset 1361 fae8fd05bccf
parent 1360 64f71d511536
child 1362 efc840374e81
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Thu Feb 28 16:43:13 2013 -0500
+++ b/playground/jsonld.js	Thu Feb 28 16:51:40 2013 -0500
@@ -4495,28 +4495,31 @@
     return e !== '.' && (e !== '' || i === segments.length - 1);
   });
 
-  // remove as many '..' as possible
-  for(var i = 0; i < segments.length;) {
-    var segment = segments[i];
-    if(segment === '..') {
-      // too many reverse dots
-      if(i === 0) {
-        var last = segments[segments.length - 1];
-        if(last !== '..') {
-          segments = [last];
+  // do not remove '..' for empty base
+  if(base.href !== '') {
+    // remove as many '..' as possible
+    for(var i = 0; i < segments.length;) {
+      var segment = segments[i];
+      if(segment === '..') {
+        // too many reverse dots
+        if(i === 0) {
+          var last = segments[segments.length - 1];
+          if(last !== '..') {
+            segments = [last];
+          }
+          else {
+            segments = [];
+          }
+          break;
         }
-        else {
-          segments = [];
-        }
-        break;
-      }
-
-      // remove '..' and previous segment
-      segments.splice(i - 1, 2);
-      i -= 1;
-    }
-    else {
-      i += 1;
+
+        // remove '..' and previous segment
+        segments.splice(i - 1, 2);
+        i -= 1;
+      }
+      else {
+        i += 1;
+      }
     }
   }