www.webdeveloper.com
Results 1 to 3 of 3

Thread: is 'innerHTML' a W3C standard

  1. #1
    Join Date
    Nov 2009
    Posts
    2

    is 'innerHTML' a W3C standard

    Hi All

    on the web you can find many things about 'innerHTML'. As far as I know it works in all browsers (on divs and spans for sure). Most/all of these posts are old, so I was wondering: Is it a W3C standard ? and (if not) are there still issues with innerHTML ?

    cheers
    numnut

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    No, innerHTML is not a standard W3C DOM method. It is an IE specific method. But it is crossbrowser so far, as it has proved its efficiency mainly in some simple AJAX applications.

    BUT!: innerHTML will not always insert all the elements nor all their attributes into the DOM tree. Nor even in IE browsers! That means sometimes an element (or its attributes) inserted with innerHTML can not be referred later on using DOM methods.

    As a general rule: you may use innerHTML when you want simply to display new elements on the document. If you need further DOM handling, you should use standard DOM methods: createElement(), createTextNode(), setAttribute(), appendChild(), and so on... Even so, take care: IE has sometimes his own vision about the way some of those methods are to be applied.
    Last edited by Kor; 11-18-2009 at 09:24 AM.

  3. #3
    Join Date
    Nov 2009
    Posts
    2
    thnx a lot!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles