File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- Copyright 2023 DigitalOcean
2
+ Copyright 2024 DigitalOcean
3
3
4
4
Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
@@ -29,8 +29,11 @@ export default class GlobEmbed {
29
29
// Save the elm
30
30
this . element = element ;
31
31
32
- // Get the gob string and remove from elm
32
+ // Get the glob string and check we have it
33
33
this . glob = element . getAttribute ( 'data-glob-string' ) ;
34
+ if ( ! this . glob ) throw new Error ( 'Glob Embed missing required data-glob-string attribute' ) ;
35
+
36
+ // Clear out the attributes we don't need
34
37
element . removeAttribute ( 'data-glob-tool-embed' ) ;
35
38
element . removeAttribute ( 'data-glob-string' ) ;
36
39
@@ -42,6 +45,7 @@ export default class GlobEmbed {
42
45
element . removeAttribute ( attr . name ) ;
43
46
}
44
47
}
48
+ if ( ! this . tests . length ) throw new Error ( 'Glob Embed missing required data-glob-test-[0-9]+ attribute(s)' ) ;
45
49
46
50
// Prep results store
47
51
this . results = [ ] ;
Original file line number Diff line number Diff line change 1
1
/*
2
- Copyright 2023 DigitalOcean
2
+ Copyright 2024 DigitalOcean
3
3
4
4
Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ window.GlobToolEmbeds = scope => {
20
20
scope = scope || document ;
21
21
22
22
// Detect all valid embeds to run
23
- const embedsElms = Array . from ( scope . querySelectorAll ( '[data-glob-tool-embed][data-glob-string][data-glob-test-1] ' ) ) ;
23
+ const embedsElms = Array . from ( scope . querySelectorAll ( '[data-glob-tool-embed]' ) ) ;
24
24
25
25
// Convert to GlobEmbed instances
26
26
const embeds = embedsElms . map ( x => new GlobEmbed ( x ) ) ;
You can’t perform that action at this time.
0 commit comments