Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

getElementsByClassName() rewritten

Andy has rewritten getElementsByClassName, resulting in much cleaner code and a method which can be called on any DOM element, not just the document object.

This is getElementsByClassName() rewritten by Simon Willison, posted on 31st March 2003.

View blog reactions

Next: Glastonbury sold out

Previous: Playing with REBOL

2 comments

  1. Doesn't work in IE whatsoever, much to my annoyance!

    Andrew - 1st April 2003 21:52 - #

  2. The reason for not working in IE is given in MSDN Library, local msdn-url:
    ms-help://MS.MSDNQTR.2003FEB.1033/script56/html/js 56jserrfunctiondoesnothavevalidprototypeobject.htm
    Which states that

    (...) external object types (are) not valid JScript objects. An external object can be an object from the host object model (for example, Internet Explorer's document or window object), or an external COM object.

    So a workaround in IE... nothing better than to define the getElementsByClassName() as a global function and throw in the actual Element-object as a parameter...

    Christian - 10th August 2004 11:40 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2003/03/31/getElementsByClassNameRewritte

A django site