@jarijokinen/consent 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/consent.js +4 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jarijokinen/consent",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A zero-dependency, vanilla JavaScript consent manager with native Consent Mode support.",
5
5
  "main": "src/consent.js",
6
6
  "repository": {
package/src/consent.js CHANGED
@@ -84,7 +84,8 @@ export const consent = (options) => {
84
84
  };
85
85
 
86
86
  const createDialog = () => {
87
- const fields = document.createElement('div');
87
+ dialog.innerHTML = opts.dialogMarkup;
88
+
88
89
  Object.keys(opts.storages).forEach((storage) => {
89
90
  const fieldset = document.createElement('fieldset');
90
91
  const checkbox = document.createElement('input');
@@ -99,10 +100,9 @@ export const consent = (options) => {
99
100
  label.innerText = opts.storages[storage];
100
101
  fieldset.appendChild(checkbox);
101
102
  fieldset.appendChild(label);
102
- fields.appendChild(fieldset);
103
+ dialog.querySelector('.consent-fields').appendChild(fieldset);
103
104
  });
104
105
 
105
- const buttons = document.createElement('div');
106
106
  Object.keys(opts.actions).forEach((action) => {
107
107
  const button = document.createElement('input');
108
108
  button.setAttribute('type', 'button');
@@ -145,12 +145,9 @@ export const consent = (options) => {
145
145
  break;
146
146
  }
147
147
 
148
- buttons.appendChild(button);
148
+ dialog.querySelector('.consent-buttons').appendChild(button);
149
149
  });
150
150
 
151
- dialog.innerHTML = opts.dialogMarkup;
152
- dialog.querySelector('.consent-fields').appendChild(fields);
153
- dialog.querySelector('.consent-buttons').appendChild(buttons);
154
151
  document.querySelector('body').appendChild(dialog);
155
152
  };
156
153