{"version":3,"names":["isElementDisabled","element","hasAttribute","getAttribute","parent","parentElement","tagName","disabled"],"sources":["is-element-disabled.ts"],"sourcesContent":["/**\n * `true` when the element is considered disabled — either via a direct\n * `disabled` attribute, an `aria-disabled=\"true\"` attribute, or an ancestor\n * `<fieldset disabled>` (which disables all form controls within it, per\n * HTML spec).\n *\n * A `null` element is treated as disabled: callers typically use this to\n * guard keyboard navigation, and a missing element should never receive\n * focus.\n */\nexport function isElementDisabled(element: Element | null): boolean {\n\tif (element == null) {\n\t\treturn true;\n\t}\n\n\tif (element.hasAttribute(\"disabled\")) {\n\t\treturn true;\n\t}\n\n\tif (element.getAttribute(\"aria-disabled\") === \"true\") {\n\t\treturn true;\n\t}\n\n\t// Nearest ancestor <fieldset disabled> disables all contained form\n\t// controls. We walk up the tree rather than relying on :disabled because\n\t// the CSS pseudo-class does not work via `element.matches` in every\n\t// environment (notably happy-dom).\n\tlet parent: Element | null = element.parentElement;\n\twhile (parent != null) {\n\t\tif (\n\t\t\tparent.tagName === \"FIELDSET\" &&\n\t\t\t(parent as HTMLFieldSetElement).disabled\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\tparent = parent.parentElement;\n\t}\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,iBAAiBA,CAACC,OAAuB,EAAW;EACnE,IAAIA,OAAO,IAAI,IAAI,EAAE;IACpB,OAAO,IAAI;EACZ;EAEA,IAAIA,OAAO,CAACC,YAAY,CAAC,UAAU,CAAC,EAAE;IACrC,OAAO,IAAI;EACZ;EAEA,IAAID,OAAO,CAACE,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM,EAAE;IACrD,OAAO,IAAI;EACZ;;EAEA;EACA;EACA;EACA;EACA,IAAIC,MAAsB,GAAGH,OAAO,CAACI,aAAa;EAClD,OAAOD,MAAM,IAAI,IAAI,EAAE;IACtB,IACCA,MAAM,CAACE,OAAO,KAAK,UAAU,IAC5BF,MAAM,CAAyBG,QAAQ,EACvC;MACD,OAAO,IAAI;IACZ;IACAH,MAAM,GAAGA,MAAM,CAACC,aAAa;EAC9B;EAEA,OAAO,KAAK;AACb","ignoreList":[]}