r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

131

u/Bl00dsoul Jun 09 '16

damn, and here i am still using 1.9

114

u/hammerha Jun 10 '16

Don't worry, even https://jquery.org/ still uses 1.11.3.

→ More replies (7)

41

u/judgej2 Jun 10 '16

The latest versions are for the cool young things and their fancy new browsers. Meanwhile, in the real world outside Silicon Valley, where sites have to work for everyone, their dog, and our parents...

26

u/habitual_viking Jun 10 '16

Jep, so much this.

Was recently asked about the jQuery we had and why we aren't upgrading, well.. we still got 6% IE 8 users (and even some IE6), with 13 million unique sessions a month, we can't really ignore 6% of potential revenue.

14

u/djxfade Jun 10 '16

I feel your pain. But don't worry, Windows 10 forced upgrade will solve this :P

15

u/colablizzard Jun 10 '16

That isn't happening on XP and Vista where it should be.

1

u/tweq Jun 10 '16

People are usually on XP because they have ancient software that doesn't work on newer versions, or because "it's good enough" and they just hate anything that looks different.

Giving free Win10 licenses to those people won't do anything, Microsoft could literally pay them to accept the upgrade and they still wouldn't do it.

2

u/colablizzard Jun 10 '16

Agreed. The crime is Microsoft tightly bundling IE with the OS...

1

u/timmyotc Jun 10 '16

That's presuming that the windows 10 drivers would keep a computer that was made in 1996 running properly without issue.

1

u/colablizzard Jun 10 '16

Agreed. The crime is Microsoft tightly bundling IE with the OS...

1

u/Extracted Jun 10 '16

There are a lot of upsides

→ More replies (3)

11

u/the_zero Jun 10 '16

IE6? Something tells me those are bots...

3

u/mycall Jun 12 '16

I got fuel for my boat the other day and their cash register computer is using a DOS program. Amazing.

1

u/the_zero Jun 12 '16

That happens a lot. The old adage is true: If it ain't broke, don't fix it. A few years back I heard a story of an Apple II being used on a farm. They can't update it, but it has one task that it had performed well for 30 years.

The register computer usually has one purpose - to run the register software. It probably isn't used to surf the web - it probably isn't hooked up to the internet at all. It is doubtful that this computer is being used to place orders on websites.

I had to deal with my auto dealer recently for service. They are using a text-bases user interface like DOS or curses (blue screen, white text, no mouse use needed) for checking inventory, ordering parts, making estimates, etc. Their computers are new, but using a old-looking interface. Its ugly and looks old-school, but it is really efficient at what it is used for.

3

u/dacjames Jun 10 '16

Dropping support for IE8 is most feasible for internal web applications, where you can simply say IE8 is not supported. The development time saved makes it easy to justify when you have a small, known user base.

1

u/schooley Jun 11 '16

Similar problem at my job-- we're making the switch to static pages for legacy browsers. Might be something to consider if it will increase productivity and you can state the case.

6

u/TheWix Jun 10 '16

We have a lot of customers in the middle east still on XP and IE 7... Older JQuery for us...

23

u/Dimasdanz Jun 10 '16

1.9? Try 1.6

27

u/prondose Jun 10 '16

1.4.2 here :\

21

u/doiveo Jun 10 '16 edited Jun 10 '16

You aren't alone.

EDIT:jQuery 1.4.2 - 2,561,262 websites. The biggest single release by use.

4

u/fuckingoverit Jun 10 '16

Comrade, we are not alone out here in the 1.4 frontier

1

u/moneymark21 Jun 10 '16

The SSO solution, made by a industry leader, used where I work uses 1.3 still. I know this because it shows up as a security that on our periodic scans.

27

u/[deleted] Jun 10 '16

[removed] — view removed comment

8

u/Vliger2002 Jun 10 '16

Still on 1.5, plebs!

6

u/[deleted] Jun 10 '16

Our CMS prebakes a version of jQuery into the load - so we are fixed with 1.11.3. So we double down on it with the latest and the old.

1

u/schooley Jun 11 '16

DotNetNuke?

1

u/[deleted] Jun 11 '16

Ektron

3

u/irukesu Jun 10 '16

Some sections still use 1.3.4, /shutters/

23

u/smith288 Jun 10 '16

Gonna remote into production today and update! Just change the 1.4 to 3.0, correct?

13

u/legec Jun 10 '16

Don't forget to turn your html tags to lowercase (to be more XHTML compliant). If you have perl installed on your production servers, it's just a simple regexp though.

12

u/smith288 Jun 10 '16

Yeah, I could just run this.

preg_replace('/<[>]*>/', '', $content)

15

u/BonzaiThePenguin Jun 10 '16

How do I make my code jump up in the air like that?

4

u/[deleted] Jun 10 '16

Don't forget to minify the file by removing all the backspaces!

33

u/chewitt Jun 10 '16 edited Jun 10 '16

Layout is broken on my android chrome... not a great sign

Edit: needs an "overflow: scroll" on code blocks

5

u/GYN-k4H-Q3z-75B Jun 10 '16

Layout is also broken on Windows 10 Edge.

1

u/mastermog Jun 11 '16

The narrow column on Android is the Slim version they are talking about

87

u/rakesh11123 Jun 10 '16

Can you add numbers in this release?

140

u/Shadowhawk109 Jun 10 '16
 var temp = 2 + "two";
 Console.log(temp);

 >:potato emoji:

45

u/outadoc Jun 10 '16

🍠

Here

9

u/AlGoreBestGore Jun 10 '16

Except that "console" is lowercase.

21

u/gerrywastaken Jun 10 '16

I'm embarrassed that I don't get this joke. What do you mean?

95

u/[deleted] Jun 10 '16

40

u/El_Impresionante Jun 10 '16

Guys, I wrote this function to jQuery to do just that. How do I get the jQuery devs to include it in the main library?

function $_add(n1, n2) {
    result = null;
	$.ajax({
		url : "https://www.google.com/search?q=" + n1.toString() + "%2B" + n2.toString(),
        context: document.body
	})
    .done(function() {
        result = parseInt($(this).find("#cwcot").text());
    });
    return result;
}

5

u/kirbyfan64sos Jun 10 '16

+1 Did not see this coming. At all.

5

u/tasty_cupcakes Jun 10 '16

Can you create a npm package for it? Thx, it's the last thing i need to finish my webscale pacemaker.

22

u/sgraf812 Jun 10 '16

It's this one

-1 not enough jQuery

14

u/sarmatron Jun 10 '16

StackOverflow does shitposts now?

30

u/[deleted] Jun 10 '16

It's not a real post, just a joke.

21

u/Arancaytar Jun 10 '16

Asked a while ago

Viewed some times

11

u/gliph Jun 10 '16

You can tell it's fake because it's not closed topic.

1

u/Fiennes Jun 10 '16

Nah - judging by the layout of the site, it looks pretty ancient.

1

u/[deleted] Jun 10 '16

thanks fellow peasant!! I didn't have to toil bcoz of you.

1

u/gerrywastaken Jun 10 '16

Haha, thank you, that's pretty great.

0

u/twiggy99999 Jun 10 '16

dying laughing at this

58

u/amclennon Jun 10 '16

Despite how far we've come in terms of browser standards and compatibility, I think jQuery's biggest strength is still its ability to handle edge cases.

The other day I ran into a very obscure bug with document.querySelectorAll(selector) that $(selector) handled just fine.

67

u/[deleted] Jun 10 '16 edited Mar 07 '24

I̴̢̺͖̱̔͋̑̋̿̈́͌͜g̶͙̻̯̊͛̍̎̐͊̌͐̌̐̌̅͊̚͜͝ṉ̵̡̻̺͕̭͙̥̝̪̠̖̊͊͋̓̀͜o̴̲̘̻̯̹̳̬̻̫͑̋̽̐͛̊͠r̸̮̩̗̯͕͔̘̰̲͓̪̝̼̿͒̎̇̌̓̕e̷͚̯̞̝̥̥͉̼̞̖͚͔͗͌̌̚͘͝͠ ̷̢͉̣̜͕͉̜̀́͘y̵̛͙̯̲̮̯̾̒̃͐̾͊͆ȯ̶̡̧̮͙̘͖̰̗̯̪̮̍́̈́̂ͅų̴͎͎̝̮̦̒̚͜ŗ̶̡̻͖̘̣͉͚̍͒̽̒͌͒̕͠ ̵̢͚͔͈͉̗̼̟̀̇̋͗̆̃̄͌͑̈́́p̴̛̩͊͑́̈́̓̇̀̉͋́͊͘ṙ̷̬͖͉̺̬̯͉̼̾̓̋̒͑͘͠͠e̸̡̙̞̘̝͎̘̦͙͇̯̦̤̰̍̽́̌̾͆̕͝͝͝v̵͉̼̺͉̳̗͓͍͔̼̼̲̅̆͐̈ͅi̶̭̯̖̦̫͍̦̯̬̭͕͈͋̾̕ͅơ̸̠̱͖͙͙͓̰̒̊̌̃̔̊͋͐ủ̶̢͕̩͉͎̞̔́́́̃́̌͗̎ś̸̡̯̭̺̭͖̫̫̱̫͉̣́̆ͅ ̷̨̲̦̝̥̱̞̯͓̲̳̤͎̈́̏͗̅̀̊͜͠i̴̧͙̫͔͖͍̋͊̓̓̂̓͘̚͝n̷̫̯͚̝̲͚̤̱̒̽͗̇̉̑̑͂̔̕͠͠s̷̛͙̝̙̫̯̟͐́́̒̃̅̇́̍͊̈̀͗͜ṭ̶̛̣̪̫́̅͑̊̐̚ŗ̷̻̼͔̖̥̮̫̬͖̻̿͘u̷͓̙͈͖̩͕̳̰̭͑͌͐̓̈́̒̚̚͠͠͠c̸̛̛͇̼̺̤̖̎̇̿̐̉̏͆̈́t̷̢̺̠͈̪̠͈͔̺͚̣̳̺̯̄́̀̐̂̀̊̽͑ͅí̵̢̖̣̯̤͚͈̀͑́͌̔̅̓̿̂̚͠͠o̷̬͊́̓͋͑̔̎̈́̅̓͝n̸̨̧̞̾͂̍̀̿̌̒̍̃̚͝s̸̨̢̗͇̮̖͑͋͒̌͗͋̃̍̀̅̾̕͠͝ ̷͓̟̾͗̓̃̍͌̓̈́̿̚̚à̴̧̭͕͔̩̬͖̠͍̦͐̋̅̚̚͜͠ͅn̵͙͎̎̄͊̌d̴̡̯̞̯͇̪͊́͋̈̍̈́̓͒͘ ̴͕̾͑̔̃̓ŗ̴̡̥̤̺̮͔̞̖̗̪͍͙̉͆́͛͜ḙ̵̙̬̾̒͜g̸͕̠͔̋̏͘ͅu̵̢̪̳̞͍͍͉̜̹̜̖͎͛̃̒̇͛͂͑͋͗͝ͅr̴̥̪̝̹̰̉̔̏̋͌͐̕͝͝͝ǧ̴̢̳̥̥͚̪̮̼̪̼͈̺͓͍̣̓͋̄́i̴̘͙̰̺̙͗̉̀͝t̷͉̪̬͙̝͖̄̐̏́̎͊͋̄̎̊͋̈́̚͘͝a̵̫̲̥͙͗̓̈́͌̏̈̾̂͌̚̕͜ṫ̸̨̟̳̬̜̖̝͍̙͙͕̞͉̈͗͐̌͑̓͜e̸̬̳͌̋̀́͂͒͆̑̓͠ ̶̢͖̬͐͑̒̚̕c̶̯̹̱̟̗̽̾̒̈ǫ̷̧̛̳̠̪͇̞̦̱̫̮͈̽̔̎͌̀̋̾̒̈́͂p̷̠͈̰͕̙̣͖̊̇̽͘͠ͅy̴̡̞͔̫̻̜̠̹̘͉̎́͑̉͝r̶̢̡̮͉͙̪͈̠͇̬̉ͅȋ̶̝̇̊̄́̋̈̒͗͋́̇͐͘g̷̥̻̃̑͊̚͝h̶̪̘̦̯͈͂̀̋͋t̸̤̀e̶͓͕͇̠̫̠̠̖̩̣͎̐̃͆̈́̀͒͘̚͝d̴̨̗̝̱̞̘̥̀̽̉͌̌́̈̿͋̎̒͝ ̵͚̮̭͇͚͎̖̦͇̎́͆̀̄̓́͝ţ̸͉͚̠̻̣̗̘̘̰̇̀̄͊̈́̇̈́͜͝ȩ̵͓͔̺̙̟͖̌͒̽̀̀̉͘x̷̧̧̛̯̪̻̳̩͉̽̈́͜ṭ̷̢̨͇͙͕͇͈̅͌̋.̸̩̹̫̩͔̠̪͈̪̯̪̄̀͌̇̎͐̃

1

u/niutech Jul 08 '16

querySelectorAll() doesn't support :has()

13

u/[deleted] Jun 10 '16

The other day I ran into a very obscure bug with document.querySelectorAll(selector) that $(selector) handled just fine.

I imagine that things could go wrong if you're doing really complex selectors. But at that point, you have to question what in the hell you're doing that requires you to select such complex selectors. Is your codebase too complicated for its own good, or does the project have complicated enough interactions that you'd be better off going for React anyway?

43

u/jesusthatsgreat Jun 10 '16

jQuery.... pahh... only losers use jQuery. I'm infinitely more productive using a combination of Mustache, Knockout, Meteor, Backbone, Ember, Gulp, Redux, nodeJS, Angular & React.

30

u/sd522527 Jun 10 '16

Hah, look at this guy, using &. Everyone knows % is where it's at!

17

u/[deleted] Jun 10 '16

The scary part is that I am not even 100% sure this is sarcastic...

1

u/isHavvy Jun 12 '16

Knockout, Meteor, Backbone, Ember, and Angular are all frameworks that fit the same niche. React + Redux together also sort of fills that niche. It's not possible to use all of them together in a reasonable way.

-1

u/dikamilo Jun 10 '16

Angular uses jQuery as dependency ;)

→ More replies (2)

10

u/Arancaytar Jun 10 '16 edited Jun 10 '16

Firefox: Current and current - 1

This seems insanely limited. At this time, the previous Firefox version came out in March on April 26, six weeks ago.

Hell, with that version requirement you can pretty much use full ES6. Is this library seriously meant to be used in production sites without Babel?

Edit: At the time of this release (June 9) Firefox 47 had been out for two days, so "current / current - 1" strictly speaking refers to 46+, even if that's not the intended meaning.

2

u/FalzHunar Jun 10 '16

Modern browsers are evergreen (auto-updating) so compatibility wouldn't be an issue.

5

u/Arancaytar Jun 10 '16

Well, I checked my site logs for today and these are the ten most popular Firefox version strings:

     63 Firefox/40.1"
     73 Firefox/14.0.1"
    101 Firefox/44.0"
    118 Firefox/45.0"
    181 Firefox/43.0"
    231 Firefox/47.0"
    257 Firefox/35.0"
    411 Firefox/21.0"
    417 Firefox/34.0"
   1903 Firefox/46.0"

Just out of those, the current Firefox version (47) makes up 6%, and the most recent two versions (46 and 47) make up 57%.

More than a third seem to be lagging by over a year. That doesn't make me very confident that I can rely on "46+" any time soon, and "current/current-1" possibly never.

12

u/CombiFish Jun 10 '16

Will this solve all my problems if I use enough of it?

9

u/tbonetexan Jun 10 '16

I do all my programming in XML.

21

u/duuuh Jun 10 '16

I had a friend who used to troll upper engineering management by saying things like "I think we can solve that with XML." He hated XML with a passion and thought they were all retarded, so the lack of push-back confirmed all of his biases.

43

u/earthboundkid Jun 09 '16

Most of what I used jQuery for was working around browser incompatibility. As IE11 becomes the trailing edge browser we need to support, the need for jQuery shrinks to zero. Once fetch becomes universal, there's not really anything left.

128

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

As IE11 becomes the trailing edge browser we need to support, the need for jQuery shrinks to zero.

Not true, because they can slim down jQuery (as you see with 3.0) which still allows you to turn what might be 20 lines of ECMA-compliant JavaScript into a one-liner that even assures you much better compatibility.

It's still useful, as long as it's not bloated, and fast.

It makes your own code more readable ... the whole "DRY principle".

This?

var d = document.getElementsByClassName("goodbye");
var i; 
for (i = 0; i < d.length; i++) { 
  d[i].className = d[i].className + " selected";
}

Or?

$(".goodbye").addClass("selected");

52

u/stns_da_mnns Jun 10 '16

Someone who gets it! There are far worse things to do than include jQuery to make your webpage slower. Who needs 4K images on a focking phone?

61

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

Yes. I try to explain it, people don't get it.

And by "people" I mean "developers" which makes it even more frightening.

Sadly, as a senior developer I've had to lay people off after I asked them, politely, numerous times to please stop trying to squeeze out the extra 15 milliseconds of some function that runs once a day and focus on the real problems on the list.

And not "Lumberg" politely ... just trying to explain that it is not a priority and we have bigger problems. It sucked. But soooo many people do this.

Because if you can shave it from 30 ms to 15 ms ... that's twice as fast. To the one person who might run it, once a day.

"But you have to pull in the whole library!".

Yes, well your logo in the top left corner is twice the size of jQuery and could be 100 times smaller and look the same.

Oh, and jQuery wasn't actually downloaded as you can see in the developer tools network panel ... it's cached on almost everyone's machine.

25

u/[deleted] Jun 10 '16

The three things you don't bring up at the dinner table: religion, politics, and jQuery.

6

u/vplatt Jun 10 '16

Wait... you said religion twice!

1

u/tuxayo Jun 10 '16

Does anyone have an idea of the time to parse/load/process jQuery compared to the time to process an over-sized image?

To know is these are relevant compared to the download time.

2

u/EternalNY1 Jun 10 '16

You can benchmark it yourself in the dev tools of whatever browser you want. This is not a hard number because it depends on the client browser, that browser's JS engine, and the client specs.

However, from the release notes, they are reducing this even further.

For the record, I think this is stupid too. Because now we're saving 7k for a version that might not be cached. Why not just stick with the regular 30k one which will likely transfer 0 bytes?

If you switch to the "Slim Build" then your server is going to be sending out 23.6k instead of 0k because it may not be cached.

Slim Build - Finally, we’ve added something new to this release.

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests.

And often it is simpler to use a combination of CSS and class manipulation for all your web animations.

Along with the regular version of jQuery that includes the ajax and effects modules, we’re releasing a “slim” version that excludes these modules.

All in all, it excludes ajax, effects, and currently deprecated code.

The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version – 23.6k vs 30k.

1

u/tuxayo Jun 11 '16

Why not just stick with the regular 30k one which will likely transfer 0 bytes?

Did someone measured the actual cache hit rate when browsing many websites? Because if the deployed versions are too various or not using the same CDN, then the caching argument would be overestimated.

Because now we're saving 7k for a version that might not be cached.

Why would it be not cached compared to the previous releases?

→ More replies (4)

12

u/puhnitor Jun 10 '16 edited Jun 10 '16
[...document.querySelectorAll('.goodbye')].forEach(goodbye => goodbye.classList.add('selected'));

80

u/EternalNY1 Jun 10 '16

forEach

Yes if you want all versions of IE dropped as well as Safari.

Or bring in jQuery, small and fast and almost guaranteed to be cached locally anyway, and get it fully compatible in 1 (shorter) line without the lambda "arrow function".

So, in your case, we'd have (works on some browsers):

[...(document.querySelectorAll('.goodbye')].forEach(goodbye => goodbye.classList.add('selected'));

Works on almost all browsers:

$(".goodbye").addClass("selected");

15

u/Elsimir Jun 10 '16

forEach is the least of the compatibility problems there too, there's a spread operator and an arrow function.

6

u/EternalNY1 Jun 10 '16

Was trying to keep it simple :)

1

u/jacobrask Jun 10 '16

jQuery, small and fast and almost guaranteed to be cached locally

That you keep claiming this in every comment does not make it any more true. There is a huge fragmentation in jQuery versions, so even if 100% of all jQuery sources were served from the same CDN the chance of them having your particular version cached is not great. See https://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/

2

u/EternalNY1 Jun 10 '16

That you keep claiming this in every comment does not make it any more true.

Where's that little emoticon with the smiley smashing his head against the wall? :)

Ok, no problem.

There's only one real way to answer this question, and since I don't work in your office ....

What percentage of your bandwidth utilization from the server is currently being taken up by serving jQuery?

Almost no one can answer that, and that is the problem. I can answer it, I know down to a single byte how much the server is sending out jQuery as opposed to the thousands of other things in a given request.

People spend all day worrying about "all these bytes being sent" when they are not looking at the numbers.

If you have the numbers, then you don't even need to be posting this, because you understand what you're doing, as do I.

1

u/cybercobra Jun 10 '16

forEach works in IE9+ and in Safari according to MDN...

1

u/EternalNY1 Jun 10 '16

forEach works in IE9+ and in Safari according to MDN...

I quoted the wrong part. Copy/paste issue.

Note that I did say:

without the lambda "arrow function".

The link you are looking for is here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#Browser_compatibility

→ More replies (31)

10

u/thebuccaneersden Jun 10 '16

that... that does not look as clean... just sayin...

24

u/EternalNY1 Jun 10 '16
  • Not as clean

  • Not as compatible

All fixed in a 34kb lib that likely will not even be downloaded because the client already has it.

4

u/earthboundkid Jun 10 '16

That's flashy, but even just querySelector basically does the hard part that jQuery used to do.

2

u/vplatt Jun 10 '16

Boo! Hiss!

2

u/puhnitor Jun 10 '16

VanillaJS is the best framework.

18

u/vplatt Jun 10 '16

I understand what you're saying, but if I have to choose between:

$(".goodbye").addClass("selected");

And:

[...document.querySelectorAll('.goodbye')].forEach(goodbye => goodbye.classList.add('selected'));

It's not much of a contest.

1

u/[deleted] Jun 10 '16

Meh, that works, but something like the bind syntax which is in proposal stage looks a lot cleaner.

1

u/kyebosh Jun 10 '16

I mean, let's not forget the 34KB library. It's not quite as clear-cut as your little example. For a light page were size & speed are paramount, you're damn right I choose the former. Just because you didn't write the code yourself doesn't mean it's not there.

25

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

34KB!!!!

I used to run a PcBoard BBS in the late 80s on a 14.4k dial-up.

34KB mattered then.

As a simple example, I just checked a few pages with (incognito, no cache, Chrome dev tools network usage):

  • Reddit: 405KB

  • CNN: 1.4 MB

  • Yahoo: 2.9 MB

  • Netflix: 3.1 MB

Are we seriously discussing 34KB that, if I wasn't clearing the cache here, would be 0?

jQuery is 1% of the Netflix homepage, in the slim chance it even needs to be downloaded at all!

Pre-optimization (or totally incorrect fake "optimization") is one of the worst things in software engineering.

EDIT: I also have Ghostery and Adblock installed, I shudder to think what those numbers would look like if I was pulling the ads and beacons.

3

u/roselan Jun 10 '16

NYT: 4.2 MB on load, 102 MB after 20 mins on page (without a blocker)

2

u/protestor Jun 10 '16

holy shit.

2

u/roselan Jun 10 '16 edited Jun 10 '16

My best bet is that there was a bug in an ad that kept dowloading shit over and over.

I checked because recently somebody claimed it was downloading tons of stuff. I had to visit several pages before I saw it happen.

edit: just checked again, and got 6.9 MB for one of their article.

0

u/[deleted] Jun 10 '16

Get uBlock Origin

→ More replies (18)

0

u/tech-ninja Jun 10 '16

If you use a library like React or framework as angular you don't even touch the DOM anymore.

And if I had to choose I would choose the former. Also basically anything that jQuery might do for me is already being fulfilled by neat libraries or native JS functions.

16

u/EternalNY1 Jun 10 '16

If you use a library like React or framework as angular you don't even touch the DOM anymore.

Right.

And I assume you are using exactly for what it was written for, which is a SPA that needs client-side MVC capability? Because from what I've seen, most people aren't.

And they also totally rewrote Angular in part because the whole "don't need to touch the DOM" turned into a performance nightmare due to the two-way-data-binding and observer stuff.

I don't want to get into a discussion on this on Reddit.

I'm comfortable in what I know at this point, which is many many years of industry experience. From HEX editing in DOS through to Angular internals.

I understand what it does, I know when it should be used.

Unfortunately, many people see "OMG I updated this JavaScript property and the screen automatically changed!".

Which is not a good place to be.

And if I had to choose I would choose the former.

If you can say that as a blanket statement, you are part of the problem.

I'm sorry, but requirements need to be looked at.

I have brought Angular in to only a handful of major projects, because they were SPAs doing what Angular does best. The rest it would have been a bloated, complex, slow nightmare.

Notice how they just totally rewrote how routing works? Hints there.

4

u/duuuh Jun 10 '16

SPA?

14

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

SPA?

If you're serious, and if you're a software developer, I'll start with this:

DO NOT use Angular.js or any similar JavaScript framework meant for this purpose ("client-side MVC") if you do not know what "SPA" is.

Single Page Application

I didn't mean that as a jab. I've been brought into projects using Angular and when I said SPA everyone stared at me like I was speaking a foreign language.

Really bad.

These frameworks have a purpose, and if they aren't used for that purpose (which is, sadly, happening everywhere) it goes south fast.

AngularJS (commonly referred to as "Angular" or "Angular.js") is a complete JavaScript-based open-source client-side web application framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.

6

u/duuuh Jun 10 '16

Ah. Not a front end guy.

8

u/EternalNY1 Jun 10 '16

I envy you.

9

u/duuuh Jun 10 '16

On the whole I agree with that sentiment. Having said that, you didn't spend an hour today tracking down a seg-fault due to an uninitialized boolean. We all have our crosses to bear.

5

u/EternalNY1 Jun 10 '16

Having said that, you didn't spend an hour today tracking down a seg-fault due to an uninitialized boolean. We all have our crosses to bear.

Believe it or not, I have been in that position also.

I don't know what's worse. I do have an existential crisis when dealing with JavaScript, but the low-level stuff is brutal in its own right.

I'm happiest in the middle ground.

→ More replies (0)

0

u/[deleted] Jun 10 '16

[deleted]

3

u/EternalNY1 Jun 10 '16

What isn't buzzworthy in this industry?

I don't care if you call them SPAs, SPWs, ROCKSTARs, NINJAs, whatever.

It basically means everything runs in the browser and calls back-end (usually REST) services via AJAX, and follows MVC, but now it's in the browser and not on the server.

Running interpreted code (and of all the ones it could be, it has to be JavaScript), which then leaves performance on the client and not the server. So one person will get a really fast page, another person will get a really slow page, because they have different system specifications client-side.

Or the browser they are using has a poor JavaScript engine.

It's moving backwards at this point.

0

u/[deleted] Jun 10 '16

[deleted]

4

u/EternalNY1 Jun 10 '16 edited Jun 10 '16

You are basically saying that anything that uses AJAX is an SPA, and therefore should be built using angular et al.

Oh, no I'm certainly not. It's just too bothersome to explain it all on Reddit.

I know Angular both v1 and v2.

It's not on my resume for a reason. I want no part of any of this right now.

I use AJAX all day. I write the REST services, I call them from JavaScript. I don't use "frameworks" outside of a very few scenarios where they are the best tool in the toolbox. I use slim JS libs or vanilla when able.

SPAs are a rare breed. They are things like Gmail and "apps" on your phone that look like an app but are actually a web page. Yet even Gmail doesn't use Angular and both are from Google!

I don't deal with them, because I choose not to.

But yes, most SPAs are HTML5+AJAX to a REST back-end.

It's just the way it is right now. Straight from the SPA Wikipedia page:

The most prominent technique currently being used is Ajax.

It's true. It doesn't mean AJAX = SPA. I know what they are. It's just that most communication between the browser and the server is done via asynchronous AJAX calls so the page doesn't have to reload. Therefore you have an "application".

Instead of a "web page".

Sort of.

What scares me the most is we moved from server-side MVC in whatever language you wanted, to client-side MVC in one language, JavaScript (or transpiled TypeScript).

This is headed in the wrong direction to me.

→ More replies (0)

2

u/patentmedicine Jun 10 '16

I worked on a website redesign where a decision was made to transform an entire site, with multiple hierarchies of navigation and myriad functionalities, into a SPA. It was a nightmare. But hey, there's a bitchin' cool Angular frontend.

2

u/tech-ninja Jun 10 '16

Angular sucks, I don't like it.

And they also totally rewrote Angular in part because the whole "don't need to touch the DOM" turned into a performance nightmare due to the two-way-data-binding and observer stuff.

The problem is how their "observers work". They're doing dirty checks with relative deep comparisons.

If you know how to use React, you can do it a lot smarter. Doing shallow checks on immutable structures.

If you can say that as a blanket statement, you are part of the problem.

I'm sorry, but requirements need to be looked at.

Unless you're doing a small website. Where you just need a contact form and show/hide an element here and there I don't want to imagine how you're building web apps if you are.

0

u/knsdklsfds Jun 10 '16

Your pure js code is really out of date. Still not as compact as jquery but a lot better

[...document.querySelectorAll('.goodbye')].forEach(e => e.classList.add('selected')) Runs in the latest Chrome or run through bable to work anywhere

33

u/HokumGuru Jun 10 '16

TIL fetch omg

66

u/kupiakos Jun 10 '16

Stop trying to make fetch happen! It's not going to happen!

-4

u/BobFloss Jun 10 '16

Why not?

19

u/bayerndj Jun 10 '16

Oh my God, Karen, you can't just ask people why they're white.

9

u/[deleted] Jun 10 '16

You can use fetch today https://github.com/github/fetch

9

u/kovensky Jun 10 '16

The main problem with fetch is that it's not cancelable -- but on the majority of use cases you don't need cancellation anyway :D

0

u/[deleted] Jun 10 '16

[deleted]

3

u/destraht Jun 10 '16

I'm not an expert in the low level API but once the request is sent then you pretty much need to let the Internet and the server do its thing. You can however choose to ignore the response or to timeout on it to then just continue on or to try again. I looked into it some months ago when I realized Doh! fetch doesn't really do what I need it to do and I just didn't put it all together until I had happily deleted out my new/old Ajax code that did not yet have fault tolerance reimplemented yet.

4

u/sparr Jun 10 '16

As IE11 becomes the trailing edge browser we need to support

Please tell me this is a real thing, somewhere in the world.

I left a job late last year where we were discussing dropping support for IE6. This was at an entertainment website company.

10

u/gearvOsh Jun 10 '16

Uh what? Every company I've worked for dropped IE6 over 4 years ago. IE8 was dropped about 1-2 years ago. IE9 is next.

Whatever company you are working for has no idea what they are doing, except for the instance where their actual traffic comes from those browsers.

4

u/earthboundkid Jun 10 '16

Yeah, IE6 is really just an unpleasant memory at this point. We stopped at IE7 in 2013, 8 in 2014, and jumped to 11 at the end of last year.

2

u/sparr Jun 10 '16

1-2% of their traffic comes from <IE8

5

u/gearvOsh Jun 10 '16

No where near warrants support.

2

u/MattBD Jun 10 '16

Microsoft don't support anything below IE9 nowadays. If the creator of a browser doesn't support it anymore, there is absolutely no justification whatsoever for anyone else doing so.

2

u/[deleted] Jun 10 '16

The software industry is filled with executives that view "money on the table" as a weakness of their sales process.

Justification isn't necessary, only rationalization.

1

u/roselan Jun 10 '16

some years ago I worked on the legacy "to be decommissioned 2 years ago" webshop for a giant company. Back then ie6 was not officially supported anymore (even if the site was "working", you could order from it).

The argument was ie6 users were used to a degraded experience anyway. And again, that was several years ago in a dysfunctional giant company. I do not envy /u/sparr job XD

1

u/civildisobedient Jun 10 '16

The reason people have to keep supporting these bullshit browsers is because of people like yourself. You are enablers. Stop providing these companies with a perfect excuse to not upgrade their ancient platforms.

2

u/sparr Jun 10 '16

people like yourself. You are enablers. Stop providing

...

I left a job

6

u/kevrom Jun 10 '16

Fetch is a simple polyfill (or 2) away. So ajax is not a valid excuse to include jQuery. Complex animations with jQuery are probably much easier than most counterparts, but that's about all I can think of really.

9

u/omnius19 Jun 10 '16

Check out gsap for complex animations. If you are coming from jQuery animations, it will blow your mind.

3

u/The_frozen_one Jun 10 '16

What do you think about Velocity.js?

3

u/omnius19 Jun 10 '16 edited Jun 10 '16

Velocity.js is a great project as well. It is essentially a complete replacement for jQuery's $.animate, although it does not need jQuery to operate anymore. It performs orders of magnitude better than jQuery, or at least it did before jQuery switched from using setTimeout to requestAnimationFrame for timing in this latest release. Also Velocity is MIT licensed. Gsap has a very permissive (free for pretty much all uses) but closed license that some will not like.

However, in my admittedly limited experience with Velocity, it falls short of Gsap when it comes to creating complex animations. The main issue is timing. Gsap has timeline functionality which lets you schedule multiple animations in sequence. It handles conflicts between animations changing the same properties at the same time. With Velocity, it is harder (at least in my opinion) to handle multi-part animations and to replay/pause animations in a reusable way. Also, I have had problems with Velocity handling transforms in weird ways compared to Gsap, although this was a while ago.

I see Velocity and Gsap as having very different purposes. If you want to make truly complex animations (think drag and drop interfaces, complex svg animations, form validation with many interacting elements, etc), Gsap is probably what you want. It is more robust and reliable. However if you just want to do simple things like sliding up a div or if you want to replace $.animate with a significantly more performant solution without changing any code, Velocity is perfect. It is much lighter weight than Gsap (although gsap is separated out into modules so you can include only what functionality you need for a project) so for simple use cases, Velocity may be the better choice.

Here is more from the creator of Gsap. Note that Velocity is no longer just a jQuery plugin.

2

u/destraht Jun 10 '16

As far as I know Fetch doesn't support timeout callbacks and stuff like that.

3

u/R4vendarksky Jun 10 '16

So much this. If you don't need 1.12 then you are probably only needing jquery because some libraries you want to use depend on it.

13

u/sevvy325 Jun 10 '16

So I'm just starting to learn web development, and I thought JQuery was pretty standard? What's the more popular choice?

2

u/lubricin Jun 10 '16

Take a look at https://leanpub.com/beyondjquery which is a walk through of apis in modern browsers.

→ More replies (4)

1

u/shevegen Jun 10 '16

I use jquery a lot.

I also doubt your statement.

→ More replies (1)

17

u/losangelesvideoguy Jun 10 '16

Not to be confused with Jake Weary.

1

u/[deleted] Jun 10 '16

Finally someone else who knows Hanselman. ☺️

9

u/[deleted] Jun 10 '16

But the question is, is it web scale?

6

u/EternallyMiffed Jun 10 '16

It must be, since it supports Sharding.

7

u/[deleted] Jun 10 '16

The similarities with Python 3 are striking:

It is a continuation of the 2.x branch, but with a few breaking changes that we felt were long overdue. While the 1.12 and 2.2 branches will continue to receive critical support patches for a time, they will not get any new features or major revisions. jQuery 3.0 is the future of jQuery. If you need IE6-8 support, you can continue to use the latest 1.12 release.

1

u/komollo Jun 11 '16

Possibly the most important thing is, can we easily convert from the old version to the new version? Like, is there an automated tool that gets you 80% of the way to upgrading? Or something that allows you to write code that is complaint with both versions using a limited feature set? Python lacked any ability to smoothly upgrade. With even the slightest consideration for upgrades, I feel that it would have been a much different story.

1

u/[deleted] Jun 11 '16

There were tools to help upgrade. That wasn't the problem.

The problem was 3rd parties having to support 2 and 3.

2

u/zelnoth Jun 10 '16

Time to update some stack overflow answers.

9

u/deus_lemmus Jun 10 '16

Oh great, more noise on stack overflow when I search for a vanilla js answer.

9

u/[deleted] Jun 10 '16

Vanilla js IS the answer! :D

7

u/printers_suck Jun 10 '16

Maybe you should use jquery

1

u/wen96 Jun 13 '16

Friday! Best day to deploy new versions.

0

u/clickclickboo Jun 10 '16

Still the best JS framework much to the chagrin of every XYZ flavor of the week out in JS land

0

u/[deleted] Jun 09 '16

[deleted]

7

u/AngularBeginner Jun 10 '16

Do you write unit tests for your code?

13

u/prewk Jun 10 '16 edited Jun 10 '16

No, you see, unit tests and React are for hipster developers*.

* code word for people who have evolved in their field the last 5-10 years or so.

3

u/dacjames Jun 10 '16

Who needs unit tests when you can just write perfect code the first time?

13

u/[deleted] Jun 10 '16

What is Simple Java?

13

u/[deleted] Jun 10 '16

Spring Doot

9

u/forreddits Jun 10 '16

all I could think of is that he is just using plain servlets.

3

u/korri123 Jun 10 '16

Rapidoid

4

u/sofia_la_negra_lulu Jun 10 '16

You forgot Typescript in the mix.

8

u/douglasg14b Jun 10 '16

Angular took some time to get used too, however now that I am familiar with its nuonces and paradigms, I end up being pretty productive. It's just so bloody easy and fast to setup at this point, not having to worry about a ton of DOM manipulation saves me loads of time and effort, not to mention a few thousand lines of JS.

Then again, I'm talking about fairly dynamic SPAs, it's completely unnecessary for more static sites.

8

u/svmk1987 Jun 10 '16

You only need Angular and React for really complex front-end apps. That is when they start becoming more useful and productive than simple jquery. Angular and react aren't a one stop solution for all front-end engineering problems. Your coworkers are probably treating them as such.

But yeah, if you try to get away with only jquery and no proper front-end framework for a complex front-end application, you can end up in a hot mess.

8

u/[deleted] Jun 10 '16

The point is, how productive will you be when you need to modify your code in 3 years from now.

3

u/foobar5678 Jun 10 '16

Exactly this. You might be able to hack something together with jQuery in 5 hours whereas it will take me 10 hours in Angular. But I'll have unit tests, well organized code (instead of one massive file), and reusable components. When you spend 10 hours in the future trying to fix bugs or add a feature, and I spend 2 hours doing it, I come out on top.

Doing things quickly today doesn't usually save you time in the long run.

4

u/[deleted] Jun 10 '16

Your clear arrogance aside, you can have tests, you can claim it's organised, and you can act like it's well structured, but I've worked on plenty of projects where all of those things were claimed, and at first sight it was true, but as you delved deeper you see that they were cargo cult programmers that produced something difficult to maintain and brittle. No amount of testing prevents bad design or poor reasoning skills.

8

u/darkpaladin Jun 10 '16

Different strokes for different folks. I'm about equivalently productive on each but the more complicated the front end is the more I shy away from jQuery into React if it's just rendering complexity or maybe Angular if its a full scale front end app. In my experience though 99/100 Angular is overkill for what you need.

The biggest challenge when dealing with front end frameworks like React is the speed at which things become unsupported. We adopted a flux library 6 months ago and now no one wants to talk about anything but Redux. If you're trying to stay on the bleeding edge, you'll find yourself in a constant rewrite/refactor loop which is probably the productivity loss you're talking about.

4

u/m3l7 Jun 10 '16

more productive spaghetti

2

u/NoDownvotesPlease Jun 10 '16

I've been able to write some lovely convoluted spaghetti with angular just as easily :)

2

u/DuoThree Jun 10 '16

typescript on his sweater already

1

u/DJDarkViper Jun 10 '16

depends on the task, I found myself at least equally more productive with less code when using Angular. But I stress equally. I can use jQuery just fine a shit out a component or background loaded data table just as fast as I can in Angular :/ I appreciate the orgabization if Angular though.

I sint even know what im getting at anymore.

1

u/csharpcheddar Jun 10 '16

Sounds like jQuery is just a small part of this comparison betweensoftware stacks

1

u/kirbyfan64sos Jun 10 '16

IMO the problem isn't necessarily with React, but with the fact that people have a tendency to use it for everything they right. Some things just really don't need it.

1

u/thrilldigger Jun 10 '16

Websockets + vanilla Java is painful. Boilerplate for days.

Spring for life.

-1

u/[deleted] Jun 10 '16

Thank god someone finally fucking gets it!

-22

u/[deleted] Jun 09 '16

a snark remark about Angular, React, and MongoDB. So original.

Lemme take a peak at that productive front end codebase of yours. You must be a swell to work with.

22

u/ThePsion5 Jun 10 '16

I was going to think of a snarky comeback, but it was updated while I was iterating over the collection so I forgot about it.

0

u/habitual_viking Jun 10 '16

Whats wrong with react now?

-23

u/QuicklyStarfish Jun 09 '16

What are you using jQuery for?

It seems entirely obsolete.

18

u/cogman10 Jun 09 '16

For a one and done webpage, it is hard to beat a JS blob and some Jquery tying it together. It still provides you with a lot of cross browser support and some nifty functionality that is more verbose to do raw. (That being said, the need for it is vastly reduced now that most browsers are pretty modern).

But for anything more complex and webappy, you probably want something more frameworky like React, Angular, Ember, Vue, Mythril, etc.

→ More replies (1)

0

u/[deleted] Jun 09 '16

[deleted]

20

u/SimplyBilly Jun 10 '16

I use React + Redux for fronted work as well and Java + PostgreSQL for the backend. For larger projects it makes life so easy compared to jQuery.

→ More replies (43)

0

u/[deleted] Jun 09 '16

[deleted]

22

u/[deleted] Jun 10 '16 edited Jun 10 '16

Angular isn't designed for every website out there. If you have a relatively simple site or if your site consists of mainly static content then you don't need to use a SPA framework. Your typical MVC framework with a mixture of jQuery will be fine.

→ More replies (1)

5

u/rDr4g0n Jun 10 '16

When building a large web app touched by 50+ different devs (almost entirely NOT UI devs) over 2 or 3 years, a heavily opinionated framework is a godsend.

→ More replies (15)

0

u/[deleted] Jun 10 '16

[deleted]

18

u/ngstyle Jun 10 '16

B... but relational DBs are not WEBSCALE.

→ More replies (4)
→ More replies (19)