UNPKG

next-csrf

Version:

CSRF mitigation library for Next.js

18 lines (14 loc) 642 B
import isValidTabindex from '../is/valid-tabindex'; export default function (element) { if (!isValidTabindex(element)) { return null; } // Edge 14 has a capitalization problem on SVG elements, // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9282058/ var hasTabindex = element.hasAttribute('tabindex'); var attributeName = hasTabindex ? 'tabindex' : 'tabIndex'; // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054 var tabindex = parseInt(element.getAttribute(attributeName), 10); return isNaN(tabindex) ? -1 : tabindex; } //# sourceMappingURL=tabindex-value.js.map