Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: DOCTYPE and scripted insertions?
09-20-2012, 03:41 AM #1
- Join Date
- Aug 2010
- Southern Oregon
- Thanked 1 Time in 1 Post
DOCTYPE and scripted insertions?
I have been using xhtml strict doctype and have used my programming text editor
to test output from php (server side) scripts by copying resulting markup from a view
source browser window to a temp file and using the text editors doctype checking capacity.
is not visible in a view source window.
So, how would I determine if a browser is not switch to quirks mode because
the added , or remove content is not compliant.
that in standards mode... specifically has both set/removeEventListener and
Thank you for time and attention
09-20-2012, 08:48 AM #2
- Join Date
- Sep 2005
- Sydney, Australia
- Thanked 741 Times in 730 Posts
If you use the DOM commands to create and add the extra content then the script will update the DOM directly and the DOM will ensure that it generates valid HTML. At least that will be true provided that you only ever ask it to generate valid DOM elements and attributes.
At least using the DOM commands will guarantee that a strict page will still remain in standards mode even if you do add invalid tags or attributes.
It is only if you use innerHTML or document.write that you can directly write to the HTML and potentially write something invalid where the browser will have to interpret what you meant and potentially put the page into quirks mode.
Users who have thanked felgall for this post: