30 - HTML Element Type Check
by steen_hansen
HTML
<!DOCTYPE html><meta charset="utf-8" />
<title id='title-id'>30 HTML Element Type Checks</title>
<div id='js-div' style="width:50%; ">
<a href='https://github.com/steenhansen/type-czech' target="_blank" class='git-hub'>GitHub Package</a>
<div id='js-code'>the javascript</div>
</div>
<div id="the-explanation" style="width:50%" class='code-scroll'>
<div class='an-explantion'>30 - HTML Element Type Checks</div>
<div id='explanation-text'>
<br>
Error found by PRE_check_changeToSubmit() when attempting to set a-table to
have the type of 'submit'.
<table id='a-table'>
<tr>
<th style='text-align: left;'>function changeToSubmit(id)</th>
<th>Change HTML Element to Submit Button</th>
</tr>
<tr><th>
OK, change plain button into Submit button
</th><th>
<button id='submit-button' type="button" disabled>Plain-Button</button> now a submit button
</th></tr>
<tr><th>
<span class='red-explanation'>Error</span>, change a-table into a Submit button
</th><th>
<div class="red-explanation">a-table cannot be a Submit button</div>
</th></tr>
</table>
<hr>
HTML elements can have their types checked.
<pre>
a_div = document.querySelector('div')
div_type = type_czech.typeFinal(a_div) //HTMLDivElement
</pre>
HTML elements can also be queried for their prototypes chain.
<pre>
a_div = document.querySelector('div')
div_protos=type_czech.typeProtos(a_div)//["HTMLDivElement","HTMLElement
</pre>
And finally, HTML elements can also be asked their object type.
<pre>
a_div = document.querySelector('div')
isa_HTMLElem = type_czech.typeIsA(a_div, 'HTMLElement') // true
</pre>
<hr>
Two errors are found by PRE_check_alterImgHref() when trying to set a-div to have a location
address, in blue text. And, when incorrectly setting a-picture's src location to a local anchor
in green text.
<table>
<tr>
<th...