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 11/*
2- Copyright 2023 DigitalOcean
2+ Copyright 2024 DigitalOcean
33
44Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
@@ -29,8 +29,11 @@ export default class GlobEmbed {
2929 // Save the elm
3030 this . element = element ;
3131
32- // Get the gob string and remove from elm
32+ // Get the glob string and check we have it
3333 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
3437 element . removeAttribute ( 'data-glob-tool-embed' ) ;
3538 element . removeAttribute ( 'data-glob-string' ) ;
3639
@@ -42,6 +45,7 @@ export default class GlobEmbed {
4245 element . removeAttribute ( attr . name ) ;
4346 }
4447 }
48+ if ( ! this . tests . length ) throw new Error ( 'Glob Embed missing required data-glob-test-[0-9]+ attribute(s)' ) ;
4549
4650 // Prep results store
4751 this . results = [ ] ;
Original file line number Diff line number Diff line change 11/*
2- Copyright 2023 DigitalOcean
2+ Copyright 2024 DigitalOcean
33
44Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ window.GlobToolEmbeds = scope => {
2020 scope = scope || document ;
2121
2222 // 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]' ) ) ;
2424
2525 // Convert to GlobEmbed instances
2626 const embeds = embedsElms . map ( x => new GlobEmbed ( x ) ) ;
You can’t perform that action at this time.
0 commit comments