Loading ...
Sorry, an error occurred while loading the content.

YUIMenuBar: Adding "id" to the anchor tag for each menu item.

Expand Messages
  • prash_monte
    Hi, Is it possible to add an id to the anchor tag of each menu item in the YUI menu bar? This is required for automated testing of my website. Thanks in
    Message 1 of 5 , Oct 6, 2009
    • 0 Attachment
      Hi,

      Is it possible to add an id to the anchor tag of each menu item in the YUI menu bar?
      This is required for automated testing of my website.

      Thanks in advance,
      Regards,
      Prashant
    • prash_monte
      Hi, Just a little more clarification. I am creating the menu bar using JSON and Javascript. Regards, Prashant
      Message 2 of 5 , Oct 6, 2009
      • 0 Attachment
        Hi,

        Just a little more clarification. I am creating the menu bar using JSON and Javascript.

        Regards,
        Prashant

        --- In ydn-javascript@yahoogroups.com, "prash_monte" <prash_monte@...> wrote:
        >
        > Hi,
        >
        > Is it possible to add an id to the anchor tag of each menu item in the YUI menu bar?
        > This is required for automated testing of my website.
        >
        > Thanks in advance,
        > Regards,
        > Prashant
        >
      • Todd Kloots
        Prashant - The easiest way to add an id to the anchor of each item would be via a render event listener: myMenuBar.subscribe( render , function () { var
        Message 3 of 5 , Oct 6, 2009
        • 0 Attachment
          Prashant -

          The easiest way to add an id to the anchor of each item would be via a
          "render" event listener:

          myMenuBar.subscribe("render", function () {

          var items = this.getItems(),
          anchor;

          for (var i=0, nItems = items.length; i<nItems; i++) {

          anchor = items[i].element.firstChild;

          YAHOO.util.Dom.generateId(anchor);

          }

          });

          - Todd

          On Oct 6, 2009, at 2:13 AM, prash_monte wrote:

          > Hi,
          >
          > Just a little more clarification. I am creating the menu bar using
          > JSON and Javascript.
          >
          > Regards,
          > Prashant
          >
          > --- In ydn-javascript@yahoogroups.com, "prash_monte"
          > <prash_monte@...> wrote:
          >>
          >> Hi,
          >>
          >> Is it possible to add an id to the anchor tag of each menu item in
          >> the YUI menu bar?
          >> This is required for automated testing of my website.
          >>
          >> Thanks in advance,
          >> Regards,
          >> Prashant
          >>
          >
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
        • prash_monte
          Thanks Todd ! That worked for me. Since an id is already defined for the menu item in the JSON, is there a possibility that the id that is applied to the
          Message 4 of 5 , Oct 6, 2009
          • 0 Attachment
            Thanks Todd ! That worked for me.

            Since an id is already defined for the menu item in the JSON, is there a possibility that the id that is applied to the <li> could be automatically applied to the anchor as well, rather than having to implement the function you have mentioned below?

            Or is there a specific reason that this was not done?

            Regards,
            Prashant

            --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@...> wrote:
            >
            > Prashant -
            >
            > The easiest way to add an id to the anchor of each item would be via a
            > "render" event listener:
            >
            > myMenuBar.subscribe("render", function () {
            >
            > var items = this.getItems(),
            > anchor;
            >
            > for (var i=0, nItems = items.length; i<nItems; i++) {
            >
            > anchor = items[i].element.firstChild;
            >
            > YAHOO.util.Dom.generateId(anchor);
            >
            > }
            >
            > });
            >
            > - Todd
            >
            > On Oct 6, 2009, at 2:13 AM, prash_monte wrote:
            >
            > > Hi,
            > >
            > > Just a little more clarification. I am creating the menu bar using
            > > JSON and Javascript.
            > >
            > > Regards,
            > > Prashant
            > >
            > > --- In ydn-javascript@yahoogroups.com, "prash_monte"
            > > <prash_monte@> wrote:
            > >>
            > >> Hi,
            > >>
            > >> Is it possible to add an id to the anchor tag of each menu item in
            > >> the YUI menu bar?
            > >> This is required for automated testing of my website.
            > >>
            > >> Thanks in advance,
            > >> Regards,
            > >> Prashant
            > >>
            > >
            > >
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            >
          • Todd Kloots
            The id of the of the menuitem s li shouldn t be applied to the anchor as well because ids need to be unique. You are the first to request the need to apply an
            Message 5 of 5 , Oct 7, 2009
            • 0 Attachment
              The id of the of the menuitem's li shouldn't be applied to the anchor
              as well because ids need to be unique. You are the first to request
              the need to apply an id to the anchor. Is there a reason why you
              can't use the id on the anchor's parent <LI>? If you've got a valid
              use case it might be something we can add in a future version of YUI.

              - Todd

              On Oct 6, 2009, at 10:32 PM, prash_monte wrote:

              > Thanks Todd ! That worked for me.
              >
              > Since an id is already defined for the menu item in the JSON, is
              > there a possibility that the id that is applied to the <li> could be
              > automatically applied to the anchor as well, rather than having to
              > implement the function you have mentioned below?
              >
              > Or is there a specific reason that this was not done?
              >
              > Regards,
              > Prashant
              >
              > --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@...> wrote:
              >>
              >> Prashant -
              >>
              >> The easiest way to add an id to the anchor of each item would be
              >> via a
              >> "render" event listener:
              >>
              >> myMenuBar.subscribe("render", function () {
              >>
              >> var items = this.getItems(),
              >> anchor;
              >>
              >> for (var i=0, nItems = items.length; i<nItems; i++) {
              >>
              >> anchor = items[i].element.firstChild;
              >>
              >> YAHOO.util.Dom.generateId(anchor);
              >>
              >> }
              >>
              >> });
              >>
              >> - Todd
              >>
              >> On Oct 6, 2009, at 2:13 AM, prash_monte wrote:
              >>
              >>> Hi,
              >>>
              >>> Just a little more clarification. I am creating the menu bar using
              >>> JSON and Javascript.
              >>>
              >>> Regards,
              >>> Prashant
              >>>
              >>> --- In ydn-javascript@yahoogroups.com, "prash_monte"
              >>> <prash_monte@> wrote:
              >>>>
              >>>> Hi,
              >>>>
              >>>> Is it possible to add an id to the anchor tag of each menu item in
              >>>> the YUI menu bar?
              >>>> This is required for automated testing of my website.
              >>>>
              >>>> Thanks in advance,
              >>>> Regards,
              >>>> Prashant
              >>>>
              >>>
              >>>
              >>>
              >>>
              >>> ------------------------------------
              >>>
              >>> Yahoo! Groups Links
              >>>
              >>>
              >>>
              >>
              >
              >
              >
              >
              > ------------------------------------
              >
              > Yahoo! Groups Links
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.