crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

Title: Still get "Invalid HTML element id: [object NodeList]" when printing NodeList in v1.6.0 #684

Open DadayaSuwen opened 1 year ago

DadayaSuwen commented 1 year ago

Content:

Dear author,

I'm using print.js v1.6.0 to print a NodeList object directly like below:

const list = document.querySelectorAll('.className');

printJS({
  printable: list,
  type: 'html'
});

However, I'm still getting the error "Invalid HTML element id: [object NodeList]" when trying to print.

I've tried:

Upgrading print.js to the latest v1.6.0 Getting NodeList via different methods like getElementByTagName Simplifying the NodeList to just one element Printing different types of elements like div, p etc. But the issue persists. As per the v1.6.0 documentation, print.js should support directly printing NodeList without converting to array.

Could you please help look into this issue? Let me know if any other details are needed. Any help would be greatly appreciated.

Thank you!