Introduction
Introduction Statistics Contact Development Disclaimer Help
tabindex.js - jscancer - Javascript crap (relatively small)
git clone git://git.codemadness.org/jscancer
Log
Files
Refs
README
LICENSE
---
tabindex.js (1408B)
---
1 // automatically increment and set tabindex on enabled/writable inputs.
2 var tabindexroots = document.querySelectorAll(".tabindex-auto");
3 if (tabindexroots && tabindexroots.length) {
4 var tabels = []; // all input elements to potentially apply tabi…
5 var selector = "input, select, textarea" // "input, select, text…
6 for (var i = 0; i < tabindexroots.length; i++) {
7 var tabindexroot = tabindexroots[i];
8 if (tabindexroot.tagName === "TABLE") {
9 // determine max column.
10 var max = -1;
11 for (var row of tabindexroot.rows) {
12 if (max === -1 || row.cells.length > max)
13 max = row.cells.length;
14 }
15 // for tables option to increase tabindex vertic…
16 for (var j = 0; j < max; j++) {
17 for (var row of tabindexroot.rows) {
18 if (j >= row.cells.length)
19 continue;
20 var inputs = row.cells[j].queryS…
21 if (inputs && inputs.length)
22 tabels = tabels.concat(A…
23 }
24 }
25 } else {
26 var els = tabindexroot.querySelectorAll(selector…
27 if (els && els.length)
28 tabels = tabels.concat(Array.from(els));
29 }
30 }
31
32 // apply tabindex.
33 var tabindexcount = 1;
34 for (var i = 0; i < tabels.length; i++) {
35 // filter elements
36 if (tabels[i].tagName == "A" ||
37 tabels[i].readOnly || tabels[i].disabled || tabels[i…
38 continue;
39 tabels[i].tabIndex = tabindexcount;
40 tabindexcount++;
41 }
42
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.