Live data from Hacker News

John Resig annotates original jQuery source code

genius.com

71–80 of 102 posts

Re: John Resig annotates original jQuery source code

#72

Anyone knows if there are outdated sites that still using early versions of jQuery? =))

I don't have any links off-hand but I know that there was a Nintendo.com sub-site that was using a pre-1.0 version of jQuery. Even though the overall code quality is rather low it did have decent browser support - unless browsers actively begin breaking their APIs (unlikely) those old versions of jQuery will probably keep working forever!

Re: John Resig annotates original jQuery source code

#73
post #65

What surprises me is the lack of comments in the original file. This leads to e.g.: this._get(i).$$tmpFunc = f; this._get(i).$$tmpFunc(i); this._get(i).$$tmpFunc = null; with the comment (from now): So this may look crazy — it certainly does to me! Why not just do: f.call(this._get(i))? If I remember correctly, and I just did some double-checking and I think this is the case, but IE 5 didn’t support .call()! The orig…

Also with all my respects to mr. Resig, but this is not really code to learn from. It's full of bad habits and it's hard to read. Poorly named, mostly uncommented and pretty hacky. Not really judging, it was just a bunch of handy hacks he had for personal use. Another reason it's hard to follow is of course: writing a CSS selector is not a trivial task, and that with all the browser quirks workarounds. I'm sure getti…

I completely agree. I tried to make a bunch of notes on the (poor) code quality, inline. This is mostly an attempt at archaeology, if you will. Naturally the current release (or even 1.0 release) of jQuery is substantially better code in every respect.

Re: John Resig annotates original jQuery source code

#74
post #37

Earlier quoted context omitted.

The main difference between Genius-style annotation and code comments, which I think is important to note (and valuable) is that code comments annotate a point or position in the source, while genius annotations are referring to a span or range in the source.

Well, I think the idea is sound. I'm even into Hip-Hop/Rap, so I should like them. Unfortunately the user interface is a world of pain. It's unusable. It's worse than quora. Good idea, but the execution needs work.

Agreed. Just separating concept from implementation.

Re: John Resig annotates original jQuery source code

#75

Anyone else already find the XSS in genius.it? Edit: wow, the whole thing is seriously broken. Emailing them now. Edit 2: It's not as broken as I thought, and these guys are quick to reply and try to figure things out. To be clear, I haven't gotten it to run arbitrary JS, just include arbitrary HTML, which isn't as dangerous.

Let us know this'd be very helpful! tom@genius.com

BTW would really love to link to a particular annotation.

Re: John Resig annotates original jQuery source code

#76

  if ( !b )
    for ( var j in a )
      this.style[j] = a[j];
  else
    this.style[a] = b;  

I really dis-liked having unnecessary braces. This… unfortunate… style preference plagued us for quite a while and caused all sorts of avoidable logic errors.

I really wish this kind of coding was removed completely from some languages.

Re: John Resig annotates original jQuery source code

#77
post #40
post #13

Earlier quoted context omitted.

This formatting style for annotated sources always seems to work so well: http://robflaherty.github.io/jquery-annotated-source/docs/01...

Strangely, the "default" Genius UI seems to be more or less the two column view - e.g., http://genius.com/1258740/Walt-whitman-song-of-myself/I-cele... Is this intentionally divergent or is it some kind of bug?

Still just as bad tbh, you still need to click through every annotation.

Re: John Resig annotates original jQuery source code

#78
post #13
post #2

Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…

This formatting style for annotated sources always seems to work so well: http://robflaherty.github.io/jquery-annotated-source/docs/01...

I built https://notedcode.com a while ago. It sets comments in any repo on GitHub or Bitbucket alongside the original source, and allows you to add and share further annotations, keeping them alongside the right section of code even when the code changes.

Re: John Resig annotates original jQuery source code

#79
I'm sorry, but this has to be said. This guy loves exclamation points! Almost every paragraph features one. It reminds me of a great Seinfeld episode:

Jake: Well, maybe I don't use my exclamation points as haphazardly as you do.

Elaine: You don't think that someone having a baby warrants an exclamation point.

Jake: Hey, I just chalked down the message. I didn't know I was required to capture the mood of each caller.

Elaine: I just thought you would be a little more excited about a friend of mine having a baby.

Jake: Ok, I'm excited. I just don't happen to like exclamation points.

Re: John Resig annotates original jQuery source code

#80

Anyone else already find the XSS in genius.it? Edit: wow, the whole thing is seriously broken. Emailing them now. Edit 2: It's not as broken as I thought, and these guys are quick to reply and try to figure things out. To be clear, I haven't gotten it to run arbitrary JS, just include arbitrary HTML, which isn't as dangerous.

>Anyone else already find the XSS in genius.it?

This is a sandboxed domain, like googleusercontent, so not a bug. XSS on genius.com would be a vulnerability.

Post reply on HN