refactor: Standardize DOM element dataset attributes across file browser component - #2543
Open
AuDevTist1C wants to merge 1 commit into
Open
Conversation
…ser component
Standardize DOM element attribute naming across the file browser component by converting legacy custom attributes to standard HTML5 `data-*` dataset attributes.
Previously, template elements mixed standard properties with proprietary, non-standard DOM attributes (such as `action`, `type`, `name`, `home`, `open-doc`, `ftp-account`, `uuid`, and `storageType`). This led to non-compliant HTML markup, required explicit `getAttribute()` and `setAttribute()` DOM calls, and increased the risk of attribute collision with future web standards.
This change enforces a uniform contract using the standard HTML5 `dataset` API (`data-*`), improving rendering consistency, type predictability, and JS-to-DOM binding efficiency.
* **Template Refactoring (`src/pages/fileBrowser/list.hbs`):**
* Converted legacy inline attributes to standard dataset equivalents: `data-action`, `data-type`, `data-name`, `data-home`, `data-open-doc`, `data-ftp-account`, `data-uuid`, and `data-storage-type`.
* Ensured boolean and string dataset values comply with template engine rendering rules.
* **Script Adaptations (`src/pages/fileBrowser/fileBrowser.js`):**
* Refactored event delegation and element lookup handlers to utilize standard camelCase JavaScript `dataset` properties (e.g., replacing `el.getAttribute('open-doc')` with `el.dataset.openDoc`, along with `dataset.action`, `dataset.uuid`, `dataset.type`, and `dataset.storageType`).
* Simplified property checks across list selection handlers and navigation logic.
* **Stylesheet Selectors (`src/pages/fileBrowser/fileBrowser.scss`):**
* Updated CSS attribute selectors from `[storageType="notification"]` to `[data-storage-type="notification"]` to maintain tight visual styling coupling without relying on invalid HTML attributes.
(AI generated commit message)
Contributor
Greptile SummaryStandardizes file-browser DOM metadata on HTML5
Confidence Score: 5/5The PR appears safe to merge, with the template producers, dataset consumers, dynamic navigation markup, and CSS selectors aligned. The changed list-rendering and open-document paths consistently emit and consume the same dataset keys, and no reachable behavioral, styling, or security failure remains. Important Files Changed
Reviews (1): Last reviewed commit: "refactor: standardize DOM element datase..." | Re-trigger Greptile |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request standardizes DOM element attribute naming across the file browser component by converting legacy custom attributes to standard HTML5
data-*dataset attributes.Previously, template elements mixed standard properties with proprietary DOM attributes (such as
action,type,name,home,open-doc,ftp-account,uuid, andstorageType). This PR updates the component to use standarddata-*markup, nativedatasetJavaScript accessors, and compliant CSS selectors.Key Changes
1. Template Refactoring (
src/pages/fileBrowser/list.hbs)data-*dataset equivalents (data-action,data-type,data-name,data-home,data-open-doc,data-ftp-account,data-uuid, anddata-storage-type).openDoc,ftpAccount).2. Script Adaptations (
src/pages/fileBrowser/fileBrowser.js)datasetproperties (e.g., replacingel.getAttribute('open-doc')withel.dataset.openDoc, along withdataset.action,dataset.uuid,dataset.type, anddataset.storageType).openDocdataset values.attr-action="navigation"withdata-action="navigation"in dynamically generated navigation tags.3. Stylesheet Selectors (
src/pages/fileBrowser/fileBrowser.scss)[storageType="notification"]to[data-storage-type="notification"].attr(storageType)toattr(data-storage-type).Benefits
getAttribute()/setAttribute()DOM calls in favor of directdatasetaccessors.(PR name and description are AI generated (Gemini 3.6 Flash))