Results 1 to 3 of 3

Thread: I can't understand what this javascript code does

  1. #1
    Join Date
    Mar 2006
    Beans
    837

    I can't understand what this javascript code does

    Hi,

    I know C++ pretty well, but I am a total noob in javascript. I was reading a piece of code and trying to understand it. Hopefully the javascript syntax is pretty close to the C++ one so I didn't have much trouble figuring out what is happening. However, I came across a line of code that although I think I understand what it does, I can't find any online reference/documentation on the method/function used.

    I'll try to give it summarised:
    PHP Code:
    function(idrowstatus){
    var 
    td = new Element('td');
    blah blah
    td
    .set('html'row[i]);

    My question is what is this "set()" method used on the last line? (I won't state what I think is happening).

    If you want more context about the actual code see here: https://github.com/qbittorrent/qBitt...cTable.js#L251
    (line 251)

    Thanks, in advance.

  2. #2
    Join Date
    Sep 2010
    Beans
    898

    Re: I can't understand what this javascript code does

    Is Element a standard Javascript class, or a custom class? I'm pretty rusty on Javascript.

  3. #3
    Join Date
    Mar 2006
    Beans
    837

    Re: I can't understand what this javascript code does

    Quote Originally Posted by Dave_L View Post
    Is Element a standard Javascript class, or a custom class? I'm pretty rusty on Javascript.
    Thanks for the hint. First I thought that Element refered to a DOM Element but actually is mootools' Element class.
    Direct link to the set() method: http://mootools.net/docs/core/Elemen...nt#Element:set

    [rant]That's why I don't like languages that don't enforce you to declare the type of a variable.[/rant]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •