New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Fix crash when id has a single-quote #2033
Conversation
e29bfbc
to
7a23522
Compare
I have used the opportunity to remove the already implicit |
@@ -62,7 +62,7 @@ export function getGridColumnHeaderElement(root: Element, field: string) { | |||
|
|||
export function getGridRowElement(root: Element, id: GridRowId) { | |||
return root.querySelector( | |||
`:scope .${GRID_ROW_CSS_CLASS}[data-id="${escapeOperandAttributeSelector(String(id))}"]`, | |||
`.${GRID_ROW_CSS_CLASS}[data-id="${escapeOperandAttributeSelector(String(id))}"]`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have an escapeRegExp
, can't we reuse it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, regexp and attribute selectors are unrelated, they use different alphabets. Why should the escaping be identical?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hence the question can't we reuse it?
if they both result in \'
or similar we might not need a new method.
Also removing :scope
will now allow the header row as a result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will keep two different methods because the concepts are unrelated.
Regarding :scope
, do you have a simple codesandbox to illustrate the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the change around :scope as it doesn't need to be in this PR, and it also doesn't seem to be that trivial. Move to #2115.
This reverts commit 7b54f30.
Fixes #1953
Hey @oliviertassinari! How does this look?
Let me know if this needs any changes! Thanks