Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if (document.implementation && document.implementation.createDocument)

Status
Not open for further replies.

12938172

Programmer
Jan 23, 2008
4
Hi Guys,

What is the meaning of the following code and what does it do:

if (document.implementation && document.implementation.createDocument)

Thanks
 
[!]implementation[/!] is a property on [!]document[/!] (document.implementation).


[!]createDocument[/!] is a method on [!]implementation[/!] (document.implementation.createDocument()).

The code checks to see of the implementation property is present on the document object, and tests that there is a createDocument method on the implementation property. If the criteria are met, then the code bounded by the fi block will be run.

This is a way to do some browser checking (by checking for the presence of browser-specific properties and methods).

In Firefox 2.0.13 on windows, both return true.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top