Skip to content

Commit 7730b10

Browse files
committed
Set default for expandAllScripts to true for flatten and toRdf.
1 parent d25c882 commit 7730b10

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/jsonld.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ jsonld.flatten = async function(input, ctx, options) {
379379
// set default options
380380
options = _setDefaults(options, {
381381
base: _isString(input) ? input : '',
382+
extractAllScripts: true,
382383
contextResolver: new ContextResolver(
383384
{sharedCache: _resolvedContextCache})
384385
});
@@ -664,6 +665,7 @@ jsonld.toRDF = async function(input, options) {
664665
// set default options
665666
options = _setDefaults(options, {
666667
base: _isString(input) ? input : '',
668+
extractAllScripts: true,
667669
skipExpansion: false,
668670
contextResolver: new ContextResolver(
669671
{sharedCache: _resolvedContextCache})
@@ -932,7 +934,7 @@ jsonld.get = async function(url, options) {
932934
remoteDoc
933935
});
934936
}
935-
if(!options.extractAllScripts) {
937+
if(frag || !options.extractAllScripts) {
936938
remoteDoc.document = remoteDoc.document[0];
937939
}
938940
} else {

tests/test-common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ const TEST_TYPES = {
8080
// NOTE: idRegex format:
8181
//MMM-manifest#tNNN$/,
8282
idRegex: [
83-
// html
84-
/html-manifest#tf004$/,
8583
]
8684
},
8785
fn: 'flatten',
@@ -157,6 +155,7 @@ const TEST_TYPES = {
157155

158156
// html
159157
/html-manifest#tr010$/,
158+
/html-manifest#tr010$/, // unescaped content
160159
// Invalid Statement
161160
/toRdf-manifest#te075$/,
162161
/toRdf-manifest#te111$/,

0 commit comments

Comments
 (0)