Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Fri, 03 May 2013 11:15:44 -0400
changeset 1619 71fe634328ef
parent 1618 b420ed168c5b
child 1620 ef04dbcdf954
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Fri May 03 10:56:29 2013 -0400
+++ b/playground/jsonld.js	Fri May 03 11:15:44 2013 -0400
@@ -4682,8 +4682,9 @@
   // use '../' for each non-matching base segment
   var rval = '';
   if(baseSegments.length > 0) {
-    // do not count the last segment if it isn't a path (doesn't end in '/')
-    if(base.normalizedPath.substr(-1) !== '/') {
+    // don't count the last segment if it isn't a path (doesn't end in '/')
+    // don't count empty first segment, it means base began with '/'
+    if(base.normalizedPath.substr(-1) !== '/' || baseSegments[0] === '') {
       baseSegments.pop();
     }
     for(var i = 0; i < baseSegments.length; ++i) {