Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8164367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:18:07+00:00 2026-06-06T19:18:07+00:00

I recently faced a problem with determining browsers’ support for certain DOM features. One

  • 0

I recently faced a problem with determining browsers’ support for certain DOM features. One of them was Element.children feature, which is still causing me headache. I have the following line in my code:

var NATIVE_CHILDREN = Element.prototype.hasOwnProperty(‘children’);

It is supposed to check if the browser supports Element.children -feature [https://developer.mozilla.org/en/DOM/Element.children].

According to MDN and quick testing, all the major browsers support this feature.

On Firebug on Firefox, value of NATIVE_CHILDREN is expectedly true. Surprisingly, on Chrome, Safari and Opera the value is false (unfortunately I don’t have accees to machine with Windows to check what IE thinks about it).

According to DOM4 – Free Editor’s Draft 5 April 2012 [http://dom.spec.whatwg.org/#element], children should be part of Element object’s prototype. Apperantly Chrome’s, Safari’s and Opera’s Element object doesn’t contain such a method!

I have tried checking the prototypes of HTMLCollection and Node (I also tested HTMLParagraphElement and HTMLBodyElement), but none of them seem to contain method called ‘children’ (except on Firefox). How can I make my test to work cross-browser? I don’t want to use any external libraries for this, because this is for my own little library.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:18:08+00:00Added an answer on June 6, 2026 at 7:18 pm

    I think the reason why this test might return false on Chrome is that you’re checking on the prototype. This is not the best way, for several reasons:

    • Different browsers can (and do) use different implementations of the prototype, some prototypes are not accessible in IE for instance. In this case, I’d say your issue is the result of chrome relying on the (non standard) __proto__ property rather then prototype. I can’t remember when, but I had a similar issue with chrome, and this was the source if the problem.

    • AFAIK all browsers have a children property for their elements, though they behave differently in some cases, so I have some doubt as to the use of checking the existence of such a property.

    • If you still want to check this, why not use document.body.hasOwnProperty('children')? Returns true on FF, Chrome, Safari and IE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently faced this annoying problem with GAE inability to handle more than one
I'm new in developing iOS app. So I've recently faced a problem with localization
I have recently been faced with a rather odd task, one result being the
I've recently faced a problem involving passing data (small amount), from a page to
I recently faced a problem about combining unit tests and doctests in Python. I
I am new to regex and recently faced this problem Appending and Prepending '#'
Recently I faced an ugly problem in my project when I begin the design
I recently start learning developing metro apps using js and I faced problem updating
I've only recently started learning ASP.NET MVC 3 and already faced with such problem.
I was recently faced with the problem of calculating the number of days from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.