alafr / SVG-to-PDFKit

Insert SVG into a PDF document created with PDFKit
MIT License
397 stars 111 forks source link

Update checking of classList contents #146

Closed julia-camintel closed 2 years ago

julia-camintel commented 3 years ago

Background

I have an SVG that uses classes and was failing with an error: svg-to-pdfkit.js:612 Uncaught TypeError: elem.classList.indexOf is not a function

Description

elem.classList returns a DOMTokenList (see Element.classList). DOMTokenList doesn't have an indexOf method which was causing this check to error. However it does have a contains method, which this PR uses to do an equivalent check.