Skip to content

Commit 67546ad

Browse files
tweak expanded display
1 parent b7b1204 commit 67546ad

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

tests/elementforms.html

+36-18
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
dom.optExpand.checked = false
125125
dom.optVertical.checked = false
126126
dom.optUnstyled.checked = false
127-
dom.optEverything.checked = false //false
127+
dom.optEverything.checked = false
128128

129129
let oData = {}
130130

@@ -236,17 +236,19 @@
236236
email: '<input id="X" type="email">',
237237
month: '<input id="X" type="month">',
238238
password: '<input id="X" type="password">',
239-
progress: '<progress id="X"></progress>',
240239
search: '<input id="X" type="search">',
241240
tel: '<input id="X" type="tel">',
242241
text: '<input id="X" type="text">',
243242
url: '<input id="X" type="url">',
244243
week: '<input id="X" type="week">',
245-
// last of the inputs
244+
// last of the inputs/forms
245+
progress: '<progress id="X"></progress>',
246246
textarea: '<textarea id="X"></textarea>',
247247
textarea_3rows_5cols: '<textarea id="X" cols="5" rows="3"></textarea>',
248248
}
249249

250+
let aNumberGroup = ['number','datetime','email','month','password','search','tel','text','url','week',]
251+
250252
if (isExpanded) {
251253
for (const k of Object.keys(oListExtra)) {
252254
oList[k] = oListExtra[k]
@@ -283,14 +285,16 @@
283285
target = document.getElementById("X")
284286
target.setAttribute("style","display:inline; writing-mode: "+ writingstring +";")
285287
if (isUnstyled) {target.classList.add('unstyled')}
286-
if (k.slice(0,8) == "select_m") {
287-
let group = "select_multiple"
288+
289+
let isNumberGroup = (aNumberGroup.includes(k) && isExpanded)
290+
if (k.slice(0,8) == "select_m" || isNumberGroup) {
291+
let group = isNumberGroup ? "number [in gecko these should be identical]" : "select_multiple"
288292
if (isEverything) {
289293
if (tmpData[style][writingstyle][group] == undefined) {tmpData[style][writingstyle][group] = {}}
290294
} else {
291295
if (tmpData[group] == undefined) {tmpData[group] = {}}
292296
}
293-
let method = k.slice(9, k.length)
297+
let method = isNumberGroup ? k : k.slice(9, k.length)
294298
// element
295299
try {
296300
data = [
@@ -303,16 +307,18 @@
303307
if (isEverything) { tmpData[style][writingstyle][group][method] = ["error"] } else { tmpData[group][method] = ["error"] }
304308
}
305309
// option
306-
data = []
307-
try {
308-
target = document.getElementById("Y")
309-
data = [
310-
target.getBoundingClientRect().width, target.getBoundingClientRect().height,
311-
target.getBoundingClientRect().x, target.getBoundingClientRect().y,
312-
]
313-
if (isEverything) { tmpData[style][writingstyle][group][method +"_option"] = data } else { tmpData[group][method +"_option"] = data }
314-
} catch(e) {
315-
if (isEverything) { tmpData[style][writingstyle][group][method +"_option"] = ["error"] } else { tmpData[group][method +"_option"] = ["error"] }
310+
if (!isNumberGroup) {
311+
data = []
312+
try {
313+
target = document.getElementById("Y")
314+
data = [
315+
target.getBoundingClientRect().width, target.getBoundingClientRect().height,
316+
target.getBoundingClientRect().x, target.getBoundingClientRect().y,
317+
]
318+
if (isEverything) { tmpData[style][writingstyle][group][method +"_option"] = data } else { tmpData[group][method +"_option"] = data }
319+
} catch(e) {
320+
if (isEverything) { tmpData[style][writingstyle][group][method +"_option"] = ["error"] } else { tmpData[group][method +"_option"] = ["error"] }
321+
}
316322
}
317323
} else {
318324
data = [
@@ -323,15 +329,27 @@
323329
}
324330
} catch(e) {
325331
if (isEverything) { tmpData[style][writingstyle][k] = ["error"] } else { tmpData[k] = ["error"] }
326-
console.log(k, e)
332+
//console.log(k, e)
327333
}
328334
}
329335
})
330336
})
331337

332338
parent.innerHTML = "" // just in case
333339
oData = {} // reset
334-
for (const k of Object.keys(tmpData).sort()) {oData[k] = tmpData[k]}
340+
for (const k of Object.keys(tmpData).sort()) {
341+
if (isEverything) {
342+
oData[k] = {}
343+
for (const j of Object.keys(tmpData[k]).sort()) {
344+
oData[k][j] = {}
345+
for (const m of Object.keys(tmpData[k][j]).sort()) {
346+
oData[k][j][m] = tmpData[k][j][m]
347+
}
348+
}
349+
} else {
350+
oData[k] = tmpData[k]
351+
}
352+
}
335353
let hash = mini(oData), notation = ""
336354

337355
let t1 = performance.now()

0 commit comments

Comments
 (0)