Fix jQuery data attribute caching issue causing expanding issues
What does this MR do?
- Use vanilla
dataset
to retrievedata-line-type
attribute- The jQuery flavor was returning an empty string and failing our logic below. From debugging the jQuery code, seems to be a internal jQuery caching issue
this.cache( owner )
. The attribute is in place before the command is run. - Here is same spot in
notes.js
before all the changes this release. It still boiled down to$(e.currentTarget || e.target).data('lineType')
previously so it is unclear how we haven't run into this before, https://gitlab.com/gitlab-org/gitlab-ce/blob/0fc1e04f4c15e9d5adbb4e47c82d3eebf8b48110/app/assets/javascripts/notes.js#L826
- The jQuery flavor was returning an empty string and failing our logic below. From debugging the jQuery code, seems to be a internal jQuery caching issue
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
In parallel diff view, find resolve/collapsed diff comment. Page-load and try to expand the diff.
Command | Result |
---|---|
$link.data('lineType') | '' |
$link.data('line-type') | '' |
$link.attr('data-line-type') | 'new' |
$link[0].dataset.lineType | 'new' |
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
- Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Edited by Eric Eastwood