This project is archived and is in readonly mode.

#748 ✓invalid

IE and .get( "text" ) throws error

Reported by schnixe | September 14th, 2009 @ 09:28 PM | in 2.0 (closed)

    <script type="text/javascript" src="mootools-1.2.3-core.js"></script>
    <script type="text/javascript">
      var tds = document.getElementsByTagName("td");
      var td  = td[1];
      alert( $type( tds ) );        // "collection"
      alert( $type( td  ) );        // "element"
      alert( td.get( "text" ) );    // nonIE: "more", IE: throws error
      alert( td.innerText );        // nonIE: undefined, IE: "more"
      alert( $(td).get( "text" ) ); // "more"

td.get( "text" ) works for me in ff 3.5.3, opera 10, chrome, safari 4.03
but not in IE 7

actually i use $( td ).get( "text" ) which works in all browsers,
but you probably want to fix that in core itself


Comments and changes to this ticket

  • Fábio M. Costa

    Fábio M. Costa September 14th, 2009 @ 10:21 PM

    • Assigned user set to “Sebastian Markbåge”

    This is the correct behavior. IE (prior to 8) doenst let the prototype of DOM node elements be changed, so you have to "force" it by using the dollar function.

    If you had used $$('td') instead of document.getElementsByTagName('td') you wouldnt need to use the dollar function.

  • schnixe

    schnixe September 14th, 2009 @ 10:34 PM

    what a pity...

    i know the $$ function and its aliases, but needed the getElementsByTagName for max speed...

    thx for fast reply.

  • Scott Kyle

    Scott Kyle September 15th, 2009 @ 05:30 PM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins