@htmltools/hdom 0.1.3 → 0.1.4
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.
- package/lib/hdom.d.ts +4 -1
- package/lib/hdom.js +5 -3
- package/package.json +1 -1
package/lib/hdom.d.ts
CHANGED
|
@@ -44,9 +44,12 @@ export class hdom {
|
|
|
44
44
|
/**
|
|
45
45
|
* @param {string} forId
|
|
46
46
|
* @param {string} text
|
|
47
|
+
* @param {Object<string,string>} [extraAtts]
|
|
47
48
|
* @returns {HTMLElement}
|
|
48
49
|
*/
|
|
49
|
-
static createLabelElement(forId: string, text: string
|
|
50
|
+
static createLabelElement(forId: string, text: string, extraAtts?: {
|
|
51
|
+
[x: string]: string;
|
|
52
|
+
}): HTMLElement;
|
|
50
53
|
/**
|
|
51
54
|
* @param {URL|string|undefined} url
|
|
52
55
|
* @param {Node|string|number} eLinkText
|
package/lib/hdom.js
CHANGED
|
@@ -99,10 +99,12 @@ export class hdom {
|
|
|
99
99
|
/**
|
|
100
100
|
* @param {string} forId
|
|
101
101
|
* @param {string} text
|
|
102
|
+
* @param {Object<string,string>} [extraAtts]
|
|
102
103
|
* @returns {HTMLElement}
|
|
103
104
|
*/
|
|
104
|
-
static createLabelElement(forId, text) {
|
|
105
|
-
const
|
|
105
|
+
static createLabelElement(forId, text, extraAtts = {}) {
|
|
106
|
+
const attributes = { for: forId, ...extraAtts };
|
|
107
|
+
const el = this.createElement("label", attributes);
|
|
106
108
|
this.setTextValue(el, text);
|
|
107
109
|
return el;
|
|
108
110
|
}
|
|
@@ -157,7 +159,7 @@ export class hdom {
|
|
|
157
159
|
* @returns {{label:HTMLElement,select:HTMLElement}}
|
|
158
160
|
*/
|
|
159
161
|
static createSelectElementWithLabel(id, label, options) {
|
|
160
|
-
const labelEl = this.createLabelElement(id,
|
|
162
|
+
const labelEl = this.createLabelElement(id, label);
|
|
161
163
|
return {
|
|
162
164
|
label: labelEl,
|
|
163
165
|
select: this.createSelectElement(id, options),
|