@@ -96,19 +96,19 @@ api.process = ({activeCtx, localCtx, options}) => {
96
96
'Unsupported JSON-LD version: ' + ctx [ '@version' ] ,
97
97
'jsonld.UnsupportedVersion' ,
98
98
{ code : 'invalid @version value' , context : ctx } ) ;
99
- } else if ( api . processingMode && api . processingMode . indexOf ( 'json-ld-1.1' ) !== 0 ) {
99
+ } else if ( activeCtx . processingMode && activeCtx . processingMode . indexOf ( 'json-ld-1.1' ) !== 0 ) {
100
100
throw new JsonLdError (
101
- '@version: ' + ctx [ '@version' ] + ' not compatible with ' + api . processingMode ,
101
+ '@version: ' + ctx [ '@version' ] + ' not compatible with ' + activeCtx . processingMode ,
102
102
'jsonld.ProcessingModeConflict' ,
103
103
{ code : 'processing mode conflict' , context : ctx } ) ;
104
104
}
105
- api . processingMode = api . processingMode || 'json-ld-1.1' ;
105
+ rval . processingMode = 'json-ld-1.1' ;
106
106
rval [ '@version' ] = ctx [ '@version' ] ;
107
107
defined [ '@version' ] = true ;
108
108
}
109
109
110
110
// If not set explicitly, set processingMode to "json-ld-1.0"
111
- api . processingMode = api . processingMode || 'json-ld-1.0' ;
111
+ rval . processingMode = rval . processingMode || activeCtx . processingMode || 'json-ld-1.0' ;
112
112
113
113
// handle @base
114
114
if ( '@base' in ctx ) {
@@ -386,7 +386,7 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
386
386
let hasSet = container . includes ( '@set' ) ;
387
387
388
388
// JSON-LD 1.1 support
389
- if ( api . processingMode . indexOf ( 'json-ld-1.1' ) === 0 ) {
389
+ if ( activeCtx . processingMode && activeCtx . processingMode . indexOf ( 'json-ld-1.1' ) === 0 ) {
390
390
// TODO: @id and @type
391
391
validContainers . push ( '@graph' ) ;
392
392
@@ -536,9 +536,6 @@ api.expandIri = (activeCtx, value, relativeTo, localCtx, defined) => {
536
536
return value ;
537
537
} ;
538
538
539
- // If not set in options, determined in first context which is an object.
540
- api . processingMode = null ;
541
-
542
539
/**
543
540
* Gets the initial context.
544
541
*
@@ -549,9 +546,9 @@ api.processingMode = null;
549
546
*/
550
547
api . getInitialContext = ( options ) => {
551
548
const base = parseUrl ( options . base || '' ) ;
552
- if ( options . processingMode ) api . processingMode = options . processingMode ;
553
549
return {
554
550
'@base' : base ,
551
+ processingMode : options . processingMode ,
555
552
mappings : { } ,
556
553
inverse : null ,
557
554
getInverse : _createInverseContext ,
0 commit comments