Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 16, 2013 @ 10:01
    Dirk De Grave
    0

    AncestorsOrSelf(nodeTypeAlias) vs AncestorOrSelf(nodeTypeAlias)

    Hi guys, 

    Just wanted to check whether my expectations are set correctly...

    AncestorsOrSelf(nodeTypeAlias) always returns the current node even if this node is not of type nodeTypeAlias. So it doesn't perform a check on type for the current node

    On the other hand, AncestorOrSelf(nodeTypeAlias) will perform a check on alias even for the this node?

    Do you think this is correct? Or do you consider this a bug

    I'm expecting that

    AncestorsOfSelf(IPublishedContent this, Func<IPublishedContent, bool> func)

    would perform the check for the this node as well as it already does for AncestorOrSelf()?

     

    Any thoughts?

    Cheers,

    /Dirk

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 16, 2013 @ 10:03
    Dirk De Grave
    0

    Oh, i'm using v4.11.4, but have noticed this is still the same in v4.11.6 (Haven't checked v6+)

     

    Cheers,

    /Dirk

  • Stephen 767 posts 2273 karma points c-trib
    Apr 16, 2013 @ 10:08
    Stephen
    0

    AncestorOrSelf(this IPublishedContent content, Func<IPublishedContent, bool> func) performs the check on every node including the current one.

    AncestorsOrSelf(this IPublishedContent content, Func<IPublishedContent, bool> func) always adds the current node to the list without performing any test.

    Still the case in the latest 6.1. I'd say it's a bug.

  • Stief Dirckx 43 posts 76 karma points
    Apr 16, 2013 @ 10:13
    Stief Dirckx
    0

    My idea also:

    AncestorsOrSelf(alias).Last() == AncestorOrSelf(alias)

    There are so many situations where you need access to all ancestors of a certain type including the current node IF ONLY it's of the same type.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 16, 2013 @ 10:14
    Dirk De Grave
    0

    Me too, considering this a bug, but bit afraid it might break lots of implementations. But anyway, bugs should be fixed! I'm filing this on the issue tracker.

     

    Cheers,

    /Dirk

  • Stephen 767 posts 2273 karma points c-trib
    Apr 16, 2013 @ 10:15
    Stephen
    0

    Have a fix available. Will push as soon as I have some time.

  • Stephen 767 posts 2273 karma points c-trib
    Apr 16, 2013 @ 10:16
    Stephen
    0

    Can you post the link to the issue here?

  • Stief Dirckx 43 posts 76 karma points
    Apr 16, 2013 @ 10:17
    Stief Dirckx
    0

    Not only for IPublishedContent, the same goes for DynamicNode.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 16, 2013 @ 10:20
    Dirk De Grave
    0

    @Stephen: Have filed a bug, so you can refer to this issue when pushing your fix: http://issues.umbraco.org/issue/U4-2117

     

    Cheers,

    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft