Parsing XML in a Web Worker

前端 未结 2 719
时光取名叫无心
时光取名叫无心 2020-12-19 05:59

I have been using a DOMParser object to parse a text string to an XML tree. However it is not available in the context of a Web Worker (and neither is, of course, document.E

2条回答
  •  暖寄归人
    2020-12-19 06:28

    according to the spec

    The DOM APIs (Node objects, Document objects, etc) are not available to workers in this version of this specification.

    I guess thats why DOMParser is not availlable, but I don't really understand why that decision was made. (fetching and processing an XML document in a WebWorker does not seems unreasonnable)

    but you can import other tools available: a "Cross Platform XML Parsing in JavaScript"

提交回复
热议问题