Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    name attribute not showing up when we inspect the element

    We are using :
    smartgwt version : SmartClient Version: v10.1p_2016-08-12/Pro Deployment (built 2016-08-12)
    browser /version : Internet Explorer 11 / 11.413.15063.0
    Problem :

    When we set the "name" attribute on a text item, the name appears in the element.

    Code :

    TextItem textItem = new TextItem();
    textItem.setName("textItem");

    Html code as seen on inspect element :

    <input name="textItem" tabindex="1103" class="textItem" id="isc_7" style="width: 146px; height: 22px;" onselect="if (window.isc_TextItem_1 == null) return;isc_TextItem_1.$1162()" oninput="isc_TextItem_1._handleInput()" type="TEXT" $9a="$9b" $89="isc_TextItem_1" autocomplete="OFF" handlenativeevents="false">


    However, when we set the name attribute on a select item or a checkbox item, the name does not appear.

    Code :
    SelectItem selectItem = new SelectItem();
    selectItem.setName("selectItem");
    selectItem.setTitle("Select");
    selectItem.setValueMap("<span style='color:#FF0000;'>Red</span>",
    "<span style='color:#00FF00;'>Green</span>",
    "<span style='color:#0000FF;'>Blue</span>");

    Html code as seen on inspect element :

    <div tabindex="1105" class="selectItemText" id="isc_K" role="presentation" style="width: 128px; height: 25px; line-height: 25px; overflow: hidden; white-space: nowrap; -ms-text-overflow: ellipsis;" $9a="$9d" $89="isc_SelectItem_1"><span aria-hidden="true">&nbsp;</span></div>
    Please let us know how we can set name for SelectItem and CheckBox so that it appears in Html inspect element ?
    Thanks

    #2
    You are probably hoping for the name attribute to appear in the DOM so you can target it for automated testing. Instead, read the docs about Automated Testing.

    Comment


      #3
      Yes you are correct but it is more than that, we want to also be able to easily identify our components by name instead of a cryptic name.
      Regarding my original question, is there an answer?

      Thanks
      Last edited by voulam; 13 Jul 2017, 07:20.

      Comment


        #4
        You didn't ask a question, but as far as your expectation, the answer is that the DOM structures used by components and not documented and subject to change at any time, as is a necessity - they need to differ by browser and often by browser version in order to work around browser bugs.

        Comment


          #5
          This was the question from my original posting:

          Please let us know how we can set name for SelectItem and CheckBox so that it appears in Html inspect element ?

          What I am understanding from your response is that setName is an undocumented feature??

          Comment


            #6
            No, our answer is what it says: the DOM is not documented and subject to change at any time.

            setName() is documented, supported and does what it says. The documentation does not set an expectation that the provided name would appear in the DOM.

            Comment

            Working...
            X