Socket
Socket
Sign inDemoInstall

dom-accessibility-api

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-accessibility-api - npm Package Compare versions

Comparing version 0.5.11 to 0.5.12

6

CHANGELOG.md
# dom-accessibility-api changelog
## 0.5.12
### Patch Changes
- [#800](https://github.com/eps1lon/dom-accessibility-api/pull/800) [`de554b0`](https://github.com/eps1lon/dom-accessibility-api/commit/de554b08c749d0f3e68baf8d7db4f0fbb571f40b) Thanks [@pablo-abc](https://github.com/pablo-abc)! - Remover circular dependency, which fixes warnings thrown in certain environments.
## 0.5.11

@@ -4,0 +10,0 @@

@@ -0,2 +1,7 @@

/**
* Safe Element.localName for all supported environments
* @param element
*/
export declare function getLocalName(element: Element): string;
export default function getRole(element: Element): string | null;
//# sourceMappingURL=getRole.d.ts.map

21

dist/getRole.js

@@ -5,6 +5,19 @@ "use strict";

exports.default = getRole;
exports.getLocalName = getLocalName;
var _util = require("./util");
// https://w3c.github.io/html-aria/#document-conformance-requirements-for-use-of-aria-attributes-in-html
// https://w3c.github.io/html-aria/#document-conformance-requirements-for-use-of-aria-attributes-in-html
/**
* Safe Element.localName for all supported environments
* @param element
*/
function getLocalName(element) {
var _element$localName;
return (// eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
(_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : // eslint-disable-next-line no-restricted-properties -- required for the fallback
element.tagName.toLowerCase()
);
}
var localNameToRoleMappings = {

@@ -112,3 +125,3 @@ article: "article",

function getImplicitRole(element) {
var mappedByTag = localNameToRoleMappings[(0, _util.getLocalName)(element)];
var mappedByTag = localNameToRoleMappings[getLocalName(element)];

@@ -119,3 +132,3 @@ if (mappedByTag !== undefined) {

switch ((0, _util.getLocalName)(element)) {
switch (getLocalName(element)) {
case "a":

@@ -122,0 +135,0 @@ case "area":

6

dist/util.d.ts

@@ -1,6 +0,2 @@

/**
* Safe Element.localName for all supported environments
* @param element
*/
export declare function getLocalName(element: Element): string;
export { getLocalName } from "./getRole";
export declare function isElement(node: Node | null): node is Element;

@@ -7,0 +3,0 @@ export declare function isHTMLTableCaptionElement(node: Node | null): node is HTMLTableCaptionElement;

"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
exports.__esModule = true;
exports.getLocalName = getLocalName;
exports.hasAnyConcreteRoles = hasAnyConcreteRoles;

@@ -22,18 +23,9 @@ exports.isElement = isElement;

var _getRole = _interopRequireDefault(require("./getRole"));
var _getRole = _interopRequireWildcard(require("./getRole"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.getLocalName = _getRole.getLocalName;
/**
* Safe Element.localName for all supported environments
* @param element
*/
function getLocalName(element) {
var _element$localName;
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
return (// eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
(_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : // eslint-disable-next-line no-restricted-properties -- required for the fallback
element.tagName.toLowerCase()
);
}
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -45,23 +37,23 @@ function isElement(node) {

function isHTMLTableCaptionElement(node) {
return isElement(node) && getLocalName(node) === "caption";
return isElement(node) && (0, _getRole.getLocalName)(node) === "caption";
}
function isHTMLInputElement(node) {
return isElement(node) && getLocalName(node) === "input";
return isElement(node) && (0, _getRole.getLocalName)(node) === "input";
}
function isHTMLOptGroupElement(node) {
return isElement(node) && getLocalName(node) === "optgroup";
return isElement(node) && (0, _getRole.getLocalName)(node) === "optgroup";
}
function isHTMLSelectElement(node) {
return isElement(node) && getLocalName(node) === "select";
return isElement(node) && (0, _getRole.getLocalName)(node) === "select";
}
function isHTMLTableElement(node) {
return isElement(node) && getLocalName(node) === "table";
return isElement(node) && (0, _getRole.getLocalName)(node) === "table";
}
function isHTMLTextAreaElement(node) {
return isElement(node) && getLocalName(node) === "textarea";
return isElement(node) && (0, _getRole.getLocalName)(node) === "textarea";
}

@@ -81,11 +73,11 @@

function isHTMLFieldSetElement(node) {
return isElement(node) && getLocalName(node) === "fieldset";
return isElement(node) && (0, _getRole.getLocalName)(node) === "fieldset";
}
function isHTMLLegendElement(node) {
return isElement(node) && getLocalName(node) === "legend";
return isElement(node) && (0, _getRole.getLocalName)(node) === "legend";
}
function isHTMLSlotElement(node) {
return isElement(node) && getLocalName(node) === "slot";
return isElement(node) && (0, _getRole.getLocalName)(node) === "slot";
}

@@ -98,7 +90,7 @@

function isSVGSVGElement(node) {
return isElement(node) && getLocalName(node) === "svg";
return isElement(node) && (0, _getRole.getLocalName)(node) === "svg";
}
function isSVGTitleElement(node) {
return isSVGElement(node) && getLocalName(node) === "title";
return isSVGElement(node) && (0, _getRole.getLocalName)(node) === "title";
}

@@ -105,0 +97,0 @@ /**

{
"name": "dom-accessibility-api",
"description": "Implements https://w3c.github.io/accname/",
"version": "0.5.11",
"version": "0.5.12",
"main": "dist/index.js",

@@ -59,3 +59,3 @@ "module": "dist/index.mjs",

"eslint": "^7.27.0",
"eslint-plugin-jest": "^25.0.0",
"eslint-plugin-jest": "^26.0.0",
"jest": "^27.0.3",

@@ -62,0 +62,0 @@ "jest-diff": "^27.0.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc