Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-20-2012, 02:41 AM   PM User | #1
anotherJEK
Regular Coder

 
Join Date: Aug 2010
Location: Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
Posts: 152
Thanks: 41
Thanked 1 Time in 1 Post
anotherJEK is an unknown quantity at this point
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.
But, when javascript is used to add content after the page loads, the markup
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.
I recently have been advised the IE 9 runs javascript differently in quirks mode
that in standards mode... specifically has both set/removeEventListener and
attach/detachEvent.

Thank you for time and attention
JK
anotherJEK is offline   Reply With Quote
Old 09-20-2012, 07:48 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Users who have thanked felgall for this post:
anotherJEK (09-21-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:18 PM.


Advertisement
Log in to turn off these ads.