Implement MooTools Element.getSiblings()

By  on  

Update: I've added the "match" option to the getSiblings() method.

While browsing through the open tickets at the MooTools LightHouse, I found this little gem proposed by SixtyMonkey:

Element.implement({
	getSiblings: function(match,nocache) {
		return this.getParent().getChildren(match,nocache).erase(this);
	}
});

The above code grabs all sibling elements (the collection of alike elements minus the "found" one.) Do you think this should be added to the core?

I submitted this to core and it has been accepted. Look forward to seeing this in core!

Recent Features

  • By
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

  • By
    Write Simple, Elegant and Maintainable Media Queries with Sass

    I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...

Incredible Demos

  • By
    Use Custom Missing Image Graphics Using MooTools

    Missing images on your website can make you or your business look completely amateur. Unfortunately sometimes an image gets deleted or corrupted without your knowledge. You'd agree with me that IE's default "red x" icon looks awful, so why not use your own missing image graphic? The MooTools JavaScript Note that...

  • By
    MooTools Clipboard Plugin

    The ability to place content into a user's clipboard can be extremely convenient for the user. Instead of clicking and dragging down what could be a lengthy document, the user can copy the contents of a specific area by a single click of a mouse.

Discussion

  1. hello david!

    i was wondering when this method would becomes part of the core? in MooTools 2 perhaps? or would you guys do something like MooTools 1.2.4 or something?

  2. It is – just not documented

  3. Arjan

    little typo

    nocash -> nocache

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!