diff --git a/CHANGELOG.md b/CHANGELOG.md index 29dca789b4..e9ddfdcd52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [4.10.2](https://github.com/dequelabs/axe-core/compare/v4.10.1...v4.10.2) (2024-10-21) + +### Bug Fixes + +- **get-ancestry:** don't error when there is no parent ([#4617](https://github.com/dequelabs/axe-core/issues/4617)) ([6c07102](https://github.com/dequelabs/axe-core/commit/6c07102b1d29145b8dc5f1d96229f3d0b8b38068)) + ### [4.10.1](https://github.com/dequelabs/axe-core/compare/v4.10.0...v4.10.1) (2024-10-16) ### Bug Fixes diff --git a/bower.json b/bower.json index 90cb051ba4..c5be151dbb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "axe-core", - "version": "4.10.1", + "version": "4.10.2", "deprecated": true, "contributors": [ { diff --git a/lib/core/utils/get-ancestry.js b/lib/core/utils/get-ancestry.js index f3ed38d272..5652c69ac0 100644 --- a/lib/core/utils/get-ancestry.js +++ b/lib/core/utils/get-ancestry.js @@ -9,7 +9,7 @@ function generateAncestry(node) { if ( nodeName !== 'head' && nodeName !== 'body' && - parentNode.children.length > 1 + parentNode?.children.length > 1 ) { const index = Array.prototype.indexOf.call(parentNode.children, node) + 1; nthChild = `:nth-child(${index})`; diff --git a/package-lock.json b/package-lock.json index d644fc18b1..f5e5af0495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "axe-core", - "version": "4.10.1", + "version": "4.10.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "axe-core", - "version": "4.10.1", + "version": "4.10.2", "license": "MPL-2.0", "devDependencies": { "@axe-core/webdriverjs": "^4.9.0", diff --git a/package.json b/package.json index dae167d915..8d32c615bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "axe-core", "description": "Accessibility engine for automated Web UI testing", - "version": "4.10.1", + "version": "4.10.2", "license": "MPL-2.0", "engines": { "node": ">=4" diff --git a/sri-history.json b/sri-history.json index cfa53c6d9d..26978ba5ce 100644 --- a/sri-history.json +++ b/sri-history.json @@ -386,5 +386,9 @@ "4.10.1": { "axe.js": "sha256-KQDnBck/AyiC+OE3x0AJ/EQYykYTnH+1z7punr4Xc0c=", "axe.min.js": "sha256-OBXf33U9n+qCj0mI9MLkiVyC1nCzabDnmopjyuv1gZ4=" + }, + "4.10.2": { + "axe.js": "sha256-+gZL/deLqt1La/rK9St/UzNzWa4co71yGT5I07FuZuE=", + "axe.min.js": "sha256-tRHNnewBx29LKtFyO2a22zfUwutO0ZkHbhgp2e57deM=" } } diff --git a/test/core/utils/get-ancestry.js b/test/core/utils/get-ancestry.js index 071853fb8d..8f570e907a 100644 --- a/test/core/utils/get-ancestry.js +++ b/test/core/utils/get-ancestry.js @@ -26,6 +26,11 @@ describe('axe.utils.getAncestry', () => { assert.isNotNull(document.querySelector(sel1)); }); + it('should not throw when there is no parent', () => { + const node = document.createElement('section'); + assert.doesNotThrow(() => axe.utils.getAncestry(node)); + }); + it('generates selectors of nested shadow trees', () => { const node = document.createElement('section'); fixture.appendChild(node);