Write Like You Render Primer Tutorial

Write Like You Render Primer Tutorial

Write Like You Render Primer Tutorial

The recent goings on with the YouTube Style SubRip Subtitles Button Tutorial thread of blog postings, uncovering for us the wonders of the great DOMParser Web API, has inspired us to write, again, a new HTML validator web application, just on the clientside of the “webpage equation”.

If you are into the creation of HTML on a Content Management System such as WordPress, here, with this blog, there is some forgiveness regarding what you construct as your content HTML and allowing that through to webpage content. But perhaps you’d …

Like to write the HTML as the web browser sees it, and then renders it

It mattered, a lot, in that project above, because for that project’s “collaboration purposes”, in the code, we wanted to know that HTML content in the caption data relevant “shadowing” textarea or textbox user interfacing elements would match any HTML element “innerHTML” or “outerHTML” or “innerText” reference later accessed. Any missing double quote mattered in this scenario. But, of course, it would be good as general practice for a Content Management System produced set of HTML to get close to that ideal HTML the web browser syntax in it’s form and format.

Which brings us to today’s …


Write Like You Render

… web application HTML validator “first draft” write_like_you_render.html with the starring codelines …


var newh=new DOMParser().parseFromString(inhtml, "text/html"); // thanks to https://stackoverflow.com/questions/57074776/parse-html-string-to-dom-and-convert-it-back-to-string
var newht=('' + newh.body.innerHTML);

… you can try for yourself here or below …

If this was interesting you may be interested in this too.

This entry was posted in Coding, eLearning, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *