SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.getElementsBySelector

    I've finally got around to implementing an idea I had ages ago: document.getElementsBySelector:

    http://simon.incutio.com/archive/200...entsBySelector

    It's a javascript function that allows you to grab an array of elements based on a CSS selector - for example, document.getElementsBySelector('div#main p a.external') returns all links with class="external" that are inside paragraphs inside a div id="main".

    I've tested it on Phoenix and IE6 and it works fine - feedback on other browsers it works with would be great.

    Cheers,

    Simon

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool. Can't say I've ever needed it, but cool
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not simply select the stylesheet rules using the DOM ? It's great that you have this idea and it works, etc.

    But I can't see a use for it personally though ? Maybe you could now implement it into an API so people cannot access a CSS selector directly ?

    You might want to consider Set and Get object methods for your API instead...


Bookmarks

Posting Permissions

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