Propogating molecule id in svg to the corresponding title element #980
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.
While drawing a reaction from a smiles string, we can set the depiction generator to add titles for each participant. The resulting svg generated has id attribute on each participant for ex: "mol1", by default on the first reactant. The corresponding title
<g>
has no correspondence with the molecule mol1. Therefore using javascript it is impossible to find out which title corresponds to which molecule in the svg. This is important if we need to fetch the metadata for the molecule (from a third service) when someone hover's over it's title.As way around would be to propagate the id attribute on the molecule as a class name in the title. This patch does this. Please feel free to review.
Following this would be to allow data-* attributes on each molecule to add metadata in the resulting svg but that would be a different pull request.