Skip to content

Commit

Permalink
Fix: Setting innerHTML in annotatorUtil.generateButton() (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum authored Oct 19, 2017
1 parent 9f06212 commit 4035d8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/annotations/__tests__/annotatorUtil-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ describe('lib/annotations/annotatorUtil', () => {

describe('generateBtn()', () => {
it('should return button node from specified details', () => {
const btn = generateBtn('class', 'title', 'content', 'type');
const btn = generateBtn('class', 'title', document.createElement('div'), 'type');
expect(btn).to.have.class('bp-btn-plain');
expect(btn).to.have.class('class');
expect(btn).to.have.attribute('data-type', 'type');
expect(btn).to.have.attribute('title', 'title');
expect(btn).to.have.text('content');
expect(btn).to.contain.html(document.createElement('div'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/annotations/annotatorUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export function generateBtn(className, title, content, dataType = '') {
buttonEl.classList.add(CLASS_BUTTON);
buttonEl.classList.add(className);
buttonEl.title = title;
buttonEl.textContent = content;
buttonEl.innerHTML = content;
buttonEl.setAttribute('data-type', dataType);
return buttonEl;
}
Expand Down

0 comments on commit 4035d8e

Please sign in to comment.