@@ -266,7 +266,8 @@ Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
266266 // resolve anything that is local
267267 for ( var ii = 0 ; ii < toResolve . length ; ii ++ ) {
268268 ( function ( item , spec , self ) {
269- if ( item . root === null || item . root === root ) {
269+ // NOTE: this used to be item.root === null, but I (@ponelat) have added a guard against .split, which means item.root can be ''
270+ if ( ! item . root || item . root === root ) {
270271 // local resolve
271272 self . resolveItem ( spec , _root , resolutionTable , resolvedRefs , unresolvedRefs , item ) ;
272273 processedCalls += 1 ;
@@ -528,6 +529,10 @@ Resolver.prototype.retainRoot = function(obj, root) {
528529Resolver . prototype . resolveInline = function ( root , spec , property , resolutionTable , unresolvedRefs , location ) {
529530 var key = property . $ref , ref = property . $ref , i , p , p2 , rs ;
530531 var rootTrimmed = false ;
532+
533+ root = root || '' // Guard against .split. @fehguy , you'll need to check if this logic fits
534+ // More imporantly is how do we gracefully handle relative urls, when provided just a 'spec', not a 'url' ?
535+
531536 if ( ref ) {
532537 if ( ref . indexOf ( '../' ) === 0 ) {
533538 // reset root
0 commit comments