Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Sat, 05 Oct 2013 00:01:29 -0400
changeset 2024 0fd990485fc3
parent 2023 8ff97032c94d
child 2025 14ef1692458b
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Fri Oct 04 14:50:25 2013 -0400
+++ b/playground/jsonld.js	Sat Oct 05 00:01:29 2013 -0400
@@ -5180,11 +5180,12 @@
   // remove root from IRI and parse remainder
   var rel = jsonld.url.parse(iri.substr(root.length));
 
-  // remove path segments that match
+  // remove path segments that match (do not remove last segment unless there
+  // is a hash or query)
   var baseSegments = base.normalizedPath.split('/');
   var iriSegments = rel.normalizedPath.split('/');
-
-  while(baseSegments.length > 0 && iriSegments.length > 0) {
+  var last = (rel.hash || rel.query) ? 0 : 1;
+  while(baseSegments.length > 0 && iriSegments.length > last) {
     if(baseSegments[0] !== iriSegments[0]) {
       break;
     }