primereact
primereact copied to clipboard
validator.w3.org shows Error "Attribute pr_id_18 not allowed on element [div]" for DataTable with Multiple Columns
Describe the bug
For DataTbale "Multiple columns" validator.w3.org shows the following error:
Attribute pr_id_18 not allowed on element div at this point.
Reproducer
No response
PrimeReact version
10.6.2
React version
17.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
- Copy the "Multiple Columns" card element of https://primereact.org/datatable/
- Paste it into https://validator.w3.org/nu/#textarea
Expected behavior
No errors in the validator output.
Well its an extra attribute causing no harm right? Its a unque identifier added to the table.
useMountEffect(() => {
if (elementRef.current) {
attributeSelector.current = UniqueComponentId();
elementRef.current.setAttribute(attributeSelector.current, '');
}
That way later with CSS selectors that can select this table if many tables like..
let selector = `[data-pc-name="datatable"][${attributeSelector.current}] > [data-pc-section="wrapper"]