Skip to content
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

Fix: Setting innerHTML in annotatorUtil.generateButton() rather than textContent #446

Merged
merged 1 commit into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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