Skip to main content

Bug Tracker

Side navigation

#4273 closed bug (invalid)

Opened March 01, 2009 03:26AM UTC

Closed November 19, 2010 02:03AM UTC

Last modified March 14, 2012 03:12PM UTC

siblings() not working in IE

Reported by: ap Owned by: john
Priority: minor Milestone:
Component: core Version: 1.3.2
Keywords: siblings Cc:
Blocked by: Blocking:
Description

this generates an error in IE:

element.siblings()[ ColumnIndex ];

I am currently using this workaround:

    /**
    * Works in IE.
    * keep this comment to reuse freely:
    * @see http://www.fullposter.com/?1
    */
    function siblings(element)
        {
        // use jquery for FF
        if ( element.siblings )
            return element.siblings();

        // do it manually
        if (typeof element == "string") { element = document.getElementById(element); };
        if (!element) { return null; };
        var siblings = [];
        var elementcopy = element;
        while (elementcopy.previousSibling)
            {
            if (elementcopy.previousSibling.nodeType == 1)
                siblings.unshift(elementcopy.previousSibling);
            elementcopy = elementcopy.previousSibling;
            }
        elementcopy = element;
        while (elementcopy.nextSibling)
            {
            if (elementcopy.nextSibling.nodeType == 1)
                siblings.push(elementcopy.nextSibling);
            elementcopy = elementcopy.nextSibling;
            }

        return siblings;
        }
Attachments (0)
Change History (3)

Changed March 05, 2009 03:43AM UTC by dmethvin comment:1

owner: → john

Changed October 14, 2009 12:57AM UTC by dmethvin comment:2

component: unfilledcore
description: this generates an error in IE: \ \ element.siblings()[ ColumnIndex ]; \ \ I am currently using this workaround: \ \ /** \ * Works in IE. \ * keep this comment to reuse freely: \ * @see http://www.fullposter.com/?1 \ */ \ function siblings(element) \ { \ // use jquery for FF \ if ( element.siblings ) \ return element.siblings(); \ \ // do it manually \ if (typeof element == "string") { element = document.getElementById(element); }; \ if (!element) { return null; }; \ var siblings = []; \ var elementcopy = element; \ while (elementcopy.previousSibling) \ { \ if (elementcopy.previousSibling.nodeType == 1) \ siblings.unshift(elementcopy.previousSibling); \ elementcopy = elementcopy.previousSibling; \ } \ elementcopy = element; \ while (elementcopy.nextSibling) \ { \ if (elementcopy.nextSibling.nodeType == 1) \ siblings.push(elementcopy.nextSibling); \ elementcopy = elementcopy.nextSibling; \ } \ \ return siblings; \ } \ \ \ this generates an error in IE: \ \ element.siblings()[ ColumnIndex ]; \ \ I am currently using this workaround: \ {{{ \ /** \ * Works in IE. \ * keep this comment to reuse freely: \ * @see http://www.fullposter.com/?1 \ */ \ function siblings(element) \ { \ // use jquery for FF \ if ( element.siblings ) \ return element.siblings(); \ \ // do it manually \ if (typeof element == "string") { element = document.getElementById(element); }; \ if (!element) { return null; }; \ var siblings = []; \ var elementcopy = element; \ while (elementcopy.previousSibling) \ { \ if (elementcopy.previousSibling.nodeType == 1) \ siblings.unshift(elementcopy.previousSibling); \ elementcopy = elementcopy.previousSibling; \ } \ elementcopy = element; \ while (elementcopy.nextSibling) \ { \ if (elementcopy.nextSibling.nodeType == 1) \ siblings.push(elementcopy.nextSibling); \ elementcopy = elementcopy.nextSibling; \ } \ \ return siblings; \ } \ }}} \ \
milestone: 1.3.2

Do you have a test case (HTML and script) that shows this problem occurring?

Changed November 19, 2010 02:03AM UTC by dmethvin comment:3

resolution: → invalid
status: newclosed

No response to test case request.