Skip to content

Commit

Permalink
add a data-rating attribute to the widget
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Sep 25, 2021
1 parent 6e71ea6 commit 913b4b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class Widget {
addRemoveClass(el, i <= index, this.props.classNames.active);
addRemoveClass(el, i === this.indexSelected, this.props.classNames.selected);
});
this.widgetEl.setAttribute('data-rating', index + 1);
if ('function' !== typeof this.props.stars && !this.props.prebuilt) { // @v3 compat
this.widgetEl.classList.remove('s' + (10 * (this.indexActive + 1)));
this.widgetEl.classList.add('s' + (10 * (index + 1)));
Expand Down

0 comments on commit 913b4b7

Please sign in to comment.