The page in question has very skeletal html sent over the wire to facilitate the building of a complicated UI in javascript.
I'm now encountering a strange browser compatibility issue that feels very much like I've got a markup problem somewhere on the page.
I've validated the page as it comes across the wire using the W3C tool and ensured there are no issues in that html. I've also tried validating the output of running on the browser console:
document.getElementsByTagName('html')[0].outerHTML
I find that the output of the above introduces lots of new issues, such as removing the trailing '/' in self closing tags. This added noise is distracting, but it also makes me uneasy about validating this method.
How do you validate markup that's rendered client side?
The World Wide Web Consortium provide a simple online tool (https://validator.w3.org/) that automatically check your HTML code and point out any problems/errors your code might have, such as missing closing tags or missing quotes around attributes.
For most browsers, to view inline JavaScript in the HTML source code, do one of the following. Press the Ctrl + U keyboard shortcut. Right-click an empty area on the web page and select the View page source or similar option in the pop-up menu.
The W3C HTML validator Note that you can also validate pages in the W3C validator from directly within the Opera browser by simply right/Ctrl-clicking and selecting the “Validate” option.
When elements are created on the client, they are created correctly by the browser - there really isn't anything to validate. The only time you'd need to validate any markup is if you're actually assigning outerHTML/innerHTML = some markup from the server
. If that's the case, just log out the results on your server and run them through the standard HTML validators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With