-
Notifications
You must be signed in to change notification settings - Fork 675
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
Update html.js #575
base: master
Are you sure you want to change the base?
Update html.js #575
Conversation
It is not always possible to send id of the html. In such cases we can use data-printid attribute.
i prefer using a common css selector, not just a data-printid attribute. can you please update your PR for me? :) |
@@ -5,7 +5,12 @@ export default { | |||
print: (params, printFrame) => { | |||
// Get the DOM printable element | |||
const printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable)
|
||
|
||
// check if data-printid for the element exist | ||
if (!printElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!printElement && document.querySelector) {
printElement = document.querySelector(params.printable);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my code below :)
It is not always possible to send id of the html. In such cases we can use data-printid attribute.