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 7434493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:50:50+00:00 2026-05-29T09:50:50+00:00

Is indexing into a NodeList using [] rather than item() completely reliable-cross browser, and

  • 0

Is indexing into a NodeList using [] rather than item() completely reliable-cross browser, and (separately) is it documented anywhere? E.g.:

var firstDiv = document.getElementsByTagName('div')[0];

As far as I can tell, the most up-to-date definition of the NodeList interface is here in DOM3, and the most recent documentation of the JavaScript bindings is in the DOM2 version. I’m not seeing anything about indexing into NodeLists via [], but I see people doing it all the time (and I’ve done it myself frequently, but always a bit nervously).

So I tried it out on a bunch of browsers, including IE6, and it works a champ everywhere I tried it (IE6, IE9, Chrome 16, Firefox 10, Firefox 5, Opera 11, Safari 5, Konqueror 4.7, Epiphany 3.0, Midori 0.4). Which is great, except I don’t have dozens of edge-case browsers around.

So I’m looking for input from anyone who’s been down this road before. Is it completely reliable cross-browser, and ideally is it documented anywhere?

  • 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-05-29T09:50:51+00:00Added an answer on May 29, 2026 at 9:50 am

    From one of your links (my emphasis):

    The items in the NodeList are accessible via an integral index, starting from 0.

    And from another link:

    The NodeList object has the following methods:

    item(index)
    This method returns a Node object.
    The index parameter is of type Number.
    Note: This object can also be dereferenced using square bracket notation (e.g. obj [ 1 ] ).
    Dereferencing with an integer index is equivalent to invoking the item method with that
    index.

    So yes, it is documented. And reliable.

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

Sidebar

Related Questions

when using lucene 3.5.0, After indexing into a RAMDirectory, is there a simple way
What is the difference, if any, between these methods of indexing into a PHP
What is the best way to do indexing into IEnumerable<T> We have a lot
Suddenly doing updates into a few tables have gotten 10 times slower than they
I'm using batch insertion of nodes and relationships into Neo4j graph database. Everything works,
I am reading about SOLR and indexing a MySQL database into SOLR. What do
I am trying to start using source indexing alongside Git on our build server
I'd like to speed-up the indexing of 10GB of data into a Lucene index.
I am using str_split() to split a long strings into an array of length
Indexing Service is set up on our file server to index a couple dozen

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.