What is the DOMParser? - JavaScript Tutorial

preview_player
Показать описание
By using the DOMParser in JavaScript you are able to construct a native Document object from an XML-based string (incl. HTML) which would then support the entire DOM API. This supports plain XML, HTML and SVG documents.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Straight to the point, clear, and helpful. I was looking all over for help on the DOMParser but only found articles that didn't address using it and the documentation itself doesn't explain it clearly. Just found your content and I'm now a subscriber 👍🏽

johnyjohny
Автор

Very helpful video and you explained it well. Thanks Dom!

MoppediP
Автор

Thanks for the video. Its really straightforward!

yinweiting
Автор

from jquery-2.1.3
tmp = new DOMParser(); xml = tmp.parseFromString( data, "text/xml" );

and jquery-3.5.1
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );

What is the difference?

mohammadirshad
Автор

Any downside to this? Looks very underrated.

Human_Evolution-
Автор

Question:

Lets say if you want to put an event listener such as onClick, how will you handle it guys?

jasonjjavier
visit shbcf.ru