Calling 'getAttribute()' on 'tr' elements logs an error to a console but works without issues

Not reproducible Issue #8066322


James W.
Jul 2, 2016
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
Found in build #
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

-I’m developing a vanilla JavaScript widget that represents a “Custom properties” table for a CMS
-The widget is a simple table with three columns - Property, Value and a command button
-The bottom row of the table contains two blank textboxes and a button, to allow the user to create a new property
-Clicking the button adds a new property to the table, through the following:

  1. The values of the inputs are extracted
  2. A new tr is created and inserted to the table before the tr containing the inputs
  3. The tr is assigned an attribute “data-ilcmsobjname” equal to the value of the “property” textbox. This uniquely identifies the property that the tr represents.
  4. Tds are created and added to the table for the property and value provided by the user. A Delete button is added to the third column.
  5. The delete button has an event handler attached through addEventListener. When clicked, it calls a delete function with the property name as a parameter - the same value as the data-ilcmsobjname assigned to the tr and entered into the “property” input by the user
    -When the user clicks the “Delete” button the following occurs:
  6. The delete function is called and supplied the name of the property to be deleted by the button’s event listener, explained above
  7. Using getElementsByTagName, all the trs in the table are retrieved and iterated over
  8. For each iteration, a check is made: if (tr.getAttribute(“data-ilcmsobjname”) == propertyName). The purpose should be clear - see if we have found the tr that contains the property/value/delete button we are removing. If it does, the tr is removed from the table.

The system is fully functioning. However, every time that last if statement is run, in which "getAttribute()" is called on the tr, the following is logged to the console as an error: “SCRIPT 438: Object doesn’t support property or method 'getAttribute’”

It appears as though it actually does support it though, since the if statement runs without problems and the correct tr is removed from the table every time. Either the console error is a mistake or getAttribute is mistakenly added as a method of tr elements.


Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Ibrahim O.”

  • Thank you for your feedback and apologize for the late response. We are having difficulties reproducing this issue on MS Edge 10586.494 current public build and Insider Preview 14392. Could you please provide us your sample or minimized sample that can demonstrate the issue. This will help our investigation.

    Best regards,
    The MS Edge Team

  • I have uploaded the relevant file. The error is thrown on line 108. I am on latest public release builds of W10 and Edge, not in Insider program.

  • Thank you for the update. We have been testing similar scenarios and have been unsuccessful generating this issue. Could you please confirm if that issue is also repro on other browsers and could you please try using different attribute names and see if you still get this error. It would also help us to identify the issue if you could provide us minimized sample that can be run locally or remotely.  

    Best regards,
    The MS Edge Team

  • Microsoft Edge Team

    Changed Assigned To from “Ibrahim O.” to “James M.”

    Changed Status to “Not reproducible”

You need to sign in to your Microsoft account to add a comment.

Sign in