 Okay, so this talk is about standards sounds boring probably is boring I Could have called it fucking standards. Why do they work as a? Or how does it work? Awesome. All right, so I'm gonna talk about standards Setting expectations for what I hope to get through in this Probably slightly too short talk First of all why should you care about standards? I think a couple years ago? I Cared theoretically, but didn't know why I should care practically how exactly does it work and How has jQuery been involved in standards and some success stories the overarching theme here is Standards actually matter jQuery's involved in them. You should probably be too if you care so first of all why should you care about all this and I Think it's very tempting to not care first of all because There's just declining trusted institutions in general in the world So the W3C is an institution so by definition if you hate Congress you probably W3C But part of why that happens is that the W3C seems like a somewhat distant organization that doesn't really understand what we're doing on a day-to-day basis and I'll talk a little bit more about the process later, but Organizations are made up of people and for example, I am a part of the W3C So obviously this is not entirely true that it's just a bunch of people sitting in a room Committing the next version of the web I think the most important reason why you should care is that the future is coming and I think it's very easy to look at what we're doing right now in terms of the last war in terms of essentially the IE 6 Stagnation and I just want to show you some graphs about how browsers have been trending because After jQuery announced that jQuery 2.0 would not support IE 6 and 7 and 8 There was a lot of gnashing of teeth and hacker news which I participated in yesterday And I think people don't really understand what has been happening I think we tell ourselves a lot of stories about why IE something or others never going to go away But that doesn't actually seem true in practice So first of all here is Internet Explorer. So here's the browser share of Internet Explorer Many raise your hand if you started around 2006 or 7 something like that So like a bunch of people like a third of the room or something started around 2006 or 2007 and it's very easy to have been to feel shell shocked by What was a crazy thing right this this was essentially a fluke in the history of the web? And it basically meant that we were stuck with really really bad browsers making up most of our customers for Actually the beginning of most of our web careers and what happened over time though is that we know the total share of Internet Explorer dropped but Additionally specifically the the way that versions of Internet Explorer that are being used You can see that the ones that we don't like are getting smaller So there's a story that we tell ourselves that like IE 6 is used in banks It's never gonna go away. Well, it actually went away Then we told ourselves like IE 7 was the browser that shipped with Windows Vista So obviously never gonna go away, right? So we have we have all these stories now IE 8 is the last Version that works on Windows XP. So now IE 8 is never gonna go away, but actually this is not true, right? So this is the structure. So if you if I could go back further if we had good numbers from before you would see a Slope, right? This is IE 7 right went up when IE 7 came out goes down And now we're sort of in the middle of the IE 8 cycle right it sucks There's still a lot of people using IE 8 but I don't see any good reason to believe that It's not going to go down like every other Internet Explorer browser and here's Internet Explorer 9. So again Internet Explorer as a whole is going down and We aren't actually seeing the disaster that we told ourselves with the Apocalypse of everyone using IE 6 forever and ever and ever that we told ourselves was gonna happen in 2007 2008 just didn't actually materialize and I think we should stop telling ourselves that story That that is not a real story on the flip side of that. There's a far more complicated story of things that have been happening since So since 90% of the browser market share is Internet Explorer We have sort of a better a better story. So this is very complicated largely because there's a lot of different versions of things So let's just zoom in on just Some specific browsers. So here's Firefox 2 and Firefox 3 in 2008, right? So sort of it looked a lot like Internet Explorer actually Now let's go to 2009 you can see Firefox 2 goes away Firefox 3 3 5 And unfortunately you can see Firefox was sort of hanging on in the same way the Internet Explorer was hanging hanging on And now you move forward to 2010 and you can see why you might be getting a little bit pessimistic Firefox 3 6 is here Firefox 3 5 is still hanging on but as you move forward Actually, that has stopped being a thing Firefox the older Firefoxes have gone away 2011 and 2012 were basically Up up and away on new browsers We've basically killed everything that's not Internet Explorer that has this weird long cycle, but not a interminable one We've basically gotten on to the fast path. So basically in the world of browser people that use browsers There's basically two groups of people. There's people that are on the slow tail Which today basically means you're using Internet Explorer It used to mean you're using Internet Explorer or Firefox But today basically using Internet Explorer or maybe like a really old version of Firefox Or maybe you're on the Firefox slow upgrading path because you're on the like LTE thing that they're doing so there's some percentage of people are on the slow tail and More and more people are on the fast path and the fast path basically it doesn't mean oh you're using Chrome So you get better features. It also means that you get better features all the time Right, so there's there's actually like a vast wilderness in between the slow tail and the and the fast path Right the people who are on the fast path are pulling away at a fast pace and the people who are in the long tail are still stuck The good news is that the slow tail is shrinking all the time So Internet Explorer for example has gotten themselves more into the fast path lane and all the time more into the fast path lane And so there's there are some people still in the slow tail But we can see the slow the whole concept of a slow tail Shrinking shrinking all the time getting smaller And we can see that the cutting edge which was basically zero percent in 2006 when a lot of us started is now Becoming the dominant story of the web right so in terms of trends We're going from everybody's on IE 6 to most people are on the cutting edge and The cutting edge itself is speeding up. So the cutting edge like I said Firefox Moving slowly Firefox now fast path Chrome fast path Safari maybe not super fast path, but definitely not like IE slow, right? So that's that's why you should care I think if you it's easy to get discouraged by the past But if you look at the trends, it's pretty clear that the trends are in the right direction And again, I don't I think we should stop telling ourselves the stupid stories about nobody will ever get off XP XP is like 15 years old if this is not actually a real thing. I Mean so it is there's there's banks that still use XP, but eventually even bank like Eventually Microsoft will stop offering support for XP and I think I think if you talk to Microsoft people they think that the entire era where they created this slow tail was like a big epic mistake and They they are happy to get it past them just as much as we are happy to get it past us So so standards how does standards work in general so This slide I have here because I think I There was this talk by Zed Shaw about why the W3Z sucks and it's like a vaudeville act of people throwing banana peels or whatever And I think the only way to really believe that it's a vaudeville act of people throwing banana peels is if you don't know Like who actually is in there? So for example Most most of the people who participate in standards discussions are implementers So the chrome team is there and the firefox team is there and the IE team is there And opera is there actually quite actively So there was a comment on Zed's post that was like standards committee should not be the ones who get to decide the future Or event the future so actually the people who get to invent the future are the browser vendors largely and they're the ones who are in the standards body, so Trying to in your head separate those two things is silly if you like chrome You probably like at least some of what the W3C is doing because they're the ones who are doing it And I and increasingly Implementers were sort of a trade organization. So it matters are who started the process But increasingly people like me people like Rick Walden people Alex Russell was sort of the pioneer of this when he was doing dojo work increasingly people like me are getting involved in the process the process is actually Some it's pretty meritocrates. It's pretty do work and you get and you get to do you get to have a say Unfortunately a lot of us don't have as much time as we would like to participate But if you do have the time if you're willing to sink the time in for whatever reason You will probably be met with People being happy that you're there I think one of the biggest questions that it that is a question in the standards discussions that Makes it hard for us to see what exactly is going on and makes it easy for us to say like this is a complete waste of time Is the question of whether there should be new sugar or new primitives? so historically the browser vendors have been very very very tilted in the terms of new pr- in the Space of new primitives give new primitives give you know a DOM API and then if library vendors want to do stuff They'll go and implement whatever needs to be done. There's increasingly an argument. That's gaining currency Which is at some point throwing a megabyte of JavaScript that everything is not really tenable for the web And so we need to actually have take a look at what exactly is in the megabyte of JavaScript that everyone's tripping and figure out What of it we could put in the platform and so I would say historically Primitives have been the way to have been the way Overwhelmingly the standards bodies have tilted more recently There's gaining currency for a higher level higher level stuff Basically based on the fact that we've all been doing this for a while now and we have a sense of some of the things that we need The W3C process is consensus driven consensus means everyone has to agree This means that things can be slow, but it means that when you get agreement everyone actually implements the thing This is actually a good idea If the alternative is that a few browser vendors get to make features that other browser vendors are vehemently against you push The standard through then IE or opera or a Firefox or Chrome hates the feature and doesn't get it This is actually not a better people want this, but it's not actually a good idea It actually believe it or not It's actually important for IE to have veto power over what happens in the standard and then again workers I should actually So veto power is is like the like nuclear weapon of consensus-driven process most consensus-driven processes don't work like that, right? So I think it's important that everyone has to get on the same page And then finally in general these processes are driven by workers Who are actually who are doing things and not by talkers? So there usually are talkers who are saying a lot of things and if you like look at the public lists It seems like they're Having a lot of currency, but actually the people who write the spec and who shepherd the spec and who respond to bugs and Who get things implemented at have significantly more currency than people who are just talking? There's sort of an exception for that if an author comes author is like the terminology for us So if an author comes to a standards body and says like this feature you're implementing doesn't really work for me and people like me Typically that will have some respect, but actually doing work is more important. Okay process, so The W3C process if you like start getting involved. There's a lot of weird acronyms But it's pretty it's not that complicated. There's basically a bunch of steps that something goes through There's a working draft, which basically means like we don't really have we don't really know what's going on We're just experimenting. We're putting something together. Maybe there's like an implementer who's who's like pushing it through There's last call, which is basically okay. We now have a spec. We think it's good Anybody have any objections or implementers happy with this? And then it goes from there to either candidate recommendation or proposed recommendation, which is basically based on whether or not there are already implementations, so There's like there's a process for this but basically if they're if you need implementations you go into CR I Actually don't remember the exact I should have made it a flow chart But basically you you walk down the you walk down the process until you get to web standard Which is that stuff like HTML for Dom 3 selectors 3 stuff that we think of as web standards I think the important thing to do the reason I put the list of actual specs on the right side is that there actually isn't really a Strong relationship between where you are in the W3C workflow and how much implementation there is so for example HTML 5 is in the working draft section together with shadow DOM which is basically completely unimplemented right so It's not really you can't go and look at like oh, what's the status and understand what's going on? You have to sort of have a bigger sense of where the standards are in terms of the implementation So the reason why there are all these steps is that there is a feedback process By far the best place for a web author or a what library developer to provide feedback is in the working draft period Which is basically like okay. We're in the middle of developing something Everyone's discussing you come up and you say like hey You know you made a mistake if you do this it's foreclosing all these things that developers want to do Last call is also an okay time to provide feedback last calls have deadlines though and Typically people think that the spec is mostly baked So if you come in in the last call and you're like this is a stupid idea. Why are you doing webGL? Probably everyone will be like get out of here And then it goes to a candidate recommendation or proposed recommendation. It's actually totally fine here to likes Suggest tweaks, but if you're again if you're off suggesting like holes like you guys got it wrong Be pretty sure that you know what you're talking about The people who actually work on these specs are Smart and have worked through implementation details And if you just comment off the street and say like in like a CRPR period like hey, you guys suck Probably people will not respond well to it Okay, so basically the short version is like if you want to be involved Try to be involved earlier because there's more opportunity to affect the outcome than trying to be involved later Pretty much all the important discussion that happens during the year happens on mailing lists The ones that I think are the most important if you wanted to describe to a bunch would be public web apps public HTML and WWE style So these are just like people who are interested in standards It's literally just discussions about standard after standard. So might be interesting or not to you I put a yes discuss in friends not because it's less important But because I don't really not really talking about JavaScript in this talk Although basically the same things apply minus the specifics of the process So now that I talked about how it actually works and how you should participate I want to talk about complaints that people have so this is again Zed's talk Everybody loves grids. Why don't we have a grid? So that's basically a short version of like layout talks And this is the sort of thing where like everyone almost everyone who watched Zed's talk was like that saying to me I understood you made the point. It was awesome great You are like the first person who has said what I believe And actually most people do believe that like the web is a stagnant thing that has no features and nobody's making progress and what the fuck is going on and Actually, no so actually almost any complaint that anybody has is being actively worked on So for example, you want a grid? Okay, there is a spec for a grid. It's being actively worked on It's been working on for over a year if you want to if you want to grid a lot And you think you have something to add to the topic, please participate in discussion Then like this is another one, which I think is relatively popular It's like, oh my god, why do I have to do margin auto left clear? seems terrible and actually okay, we people know about this problem and This spec was started being worked on 2009 based on a thing that was in Firefox for like a decade and Here's how you center stuff using flexbox It's not actually that complicated And I think again, I think obviously because of the fact that we're all still working with Internet Explorer There's basically two concerns being Conflated here. There's the concern like it sucks I can't use any of these new features because I stopped to support IE and then there's for some reason people go off the rails Like nobody's working on anything actually no people are working on stuff And it is does in fact suck that you're not working on IE But nobody in the world unless you have a time machine can actually go back and fix the fact that IE 6 doesn't have flexbox So what we should be doing is dealing with that by you know getting people on the fast path the Projects like chrome frame are helping with that But what we should be doing if we're upset at the W3C for not doing things is We should look at to see what they actually are doing and then we should see what browsers that are part of W3C Are implementing so for example flexbox actually is relatively widely implemented You might be upset at IE for not for not supporting it. That's a valid thing to complain to them about But the point is It works today in chrome right like this The the I use these two examples because I think they have wide currency like this is broken W3C should be working on it Pretty much every single thing that you think is important Somebody is working on and there's an active spec for it if you care a lot about something go participate in the discussion That should say implementers I Just want to say if you again if you like what chrome is doing Implementers are the standards bodies I actually really enjoy working with the chrome guys so the chrome guys are on all these on these committees and my Involvement in the committees is pretty heavily tilted towards working with existing implementers including people on chrome to get specs done And I think most importantly the guys who are working on these things actually really want our feedback So they spend way too much time trying to figure out how to get our feedback It would be a lot easier if we all just went and gave it to them Probably not all of us, but more of us involved in libraries and people have time so that's that's the like Why can't I center shit and just a suit just I only had 40 minutes pretend I went and Went through like every single complaint and showed you a spec for it because I could do that Okay, and the last thing I want to do is just talk about some examples of stuff. We've been doing so All the stuff that I said up until now is stuff I've believed for a while and part of my what I've done with the jQuery Foundation over the past year or so is get the jQuery foundation to be real official members of the W3C and Echma So that I can actually go together with other people on the jQuery foundation who are interested in these topics and Participate in the face-to-face discussion So everything happens by email for the most part, but then there are a few face-to-face discussions Which are obviously somewhat important you want to be there So I want to talk about two things that we did basically Through the jQuery foundation to help make standards that are going to be helpful So the first one is we did not make query selector all that's pretty old spec at this point believe it or not But it's actually broken a query selector all is broken So everybody who says like I don't need to use jQuery no problem. I'll just use query selector all Unfortunately, if you look at the query selector all implementation in jQuery There's a bunch of work to get around bugs Unfortunately These problems were known to the people working on the feature at the time because John told them about these problems And they said we'll get it in selectors, too So in fact we are getting it in selectors, too But as as could have been predicted there has been a very long time where there's selectors one without selectors, too Where we have to live with the bugs so that sucks But I think we're make we're making things better now. So here's here's a bug in query selector all So you have a div Grandparent p which is a parent a span which is a child and you say, okay, give me the parent and then give me all the div spans under that Almost everybody I know thinks that the correct answer here is that it's no element Basically that the second query selector all is pretends that the root is the p It's how jQuery works and every other selector engine that exists works But the way this actually works in the browser is that it basically does it finds all the spans that match divs Span that are inside of parent so it actually matches that span because it is a div span from the from the perspective of the entire Document what this basically means is that jQuery could not just simply drop in query selector all we have to do a hack Where we add Synthetic ID onto the element and then do a query against that and then also deal with like what happens if you have commas and stuff like This so this is not good and obviously there are limitations when you have like colon not and stuff like that So not not a good situation This is my email box around the time where we were discussing it so you can see on the bottom Qsa the problem with scope and naming you can see a hundred next to that then you see re re qsa the problem with scope and naming 36 anyway so lots and lots and lots of emails starting in October 2011 but the good news is ending in December 12 2011 with proposed specification for find find all matches This is a good thing. This is a good thing It means that we have actually successfully gotten the w3c together with a lot of browser implementers We're very interested in fixing these bugs to have a spec that actually matches the behavior that people will expect This is like one of the early things that I that what I said about this you can see the example up there I'm like basic. I thought I talked to a bunch of people. Nobody thinks this is the correct behavior So this seems obvious. I think one of the sad things about Standards is that everyone thinks like oh, obviously, that's wrong just fix it, right? Like anytime justice at the beginning of a sentence, you know bad things are happening So at the time I said like I think the punishment for like screwing up a spec should have to be that you're the next time You do it you have to use a shorter name so So we got fine and find all because so now we don't have to worry about query selector Anyway, there was a lot of issues like there's a new feature Which lets you have a CSS style that is scoped to a particular element. How does that interact with this? What if you actually use colon scope, which is a CSS for feature which lets you? Basically, which lets you have a selector against the current scope What should we name this should we name a fine find all or something else? What about matches selector which is basically a companion for this which jQuery also uses how does that work exactly? What are the semantics? There was a long conversation in the middle like why don't people just use xpath? Which we have to actually get through because that's how the consensus process works There's a question of combinators So this doesn't actually make sense from the perspective of CSS you're like finding child div like what does that mean? But everyone everyone intuitively knows that it makes sense So we have to describe a mechanism for making it make sense And then like what should it return should it return an array or a node list or static node list or whatever So there's all these discussions that happen when you open these kind of worms that you have to get through You have to actually get to the end You have to you don't get basically what happened wrong with what selectors one is that we went in and we said like there Is a bug and then we left and everyone said okay cool story and moved on you have to actually walk through the hundred messages The 500 messages or whatever so you can see here for example. They were like Here's a bunch of edge cases. How does it work? And I basically like I guess it works like this And I basically was like here's a chance fit all with how jQuery does it here's the answers Here's how combinators work in jQuery right So I basically went through and walked everyone through like what was happening in jQuery And I think basically this is how we should be Looking at the standards process is We already we basically have a bunch of stuff that we do ad hoc on the web And it's very easy to say like just make jQuery the DOM API, but jQuery does a lot of things ad hoc Based on bugs that were submitted. We have to actually make it make sense in the language of the standard We have to make it make be coherent There's a lot of things that are incoherent about jQuery just because of how it was built over time So figuring out like basically creating a formal way of understanding what it means to have a combinator at the beginning was Very important and we have to actually get all the way to the end. So that's one Success story. I think we got a spec in that is going to be good If it's actually good for people don't want to use jQuery now You actually have a mechanism for using with not a massively long word a short word and and something that actually has the correct semantics which is great Another one is document that parse which I was not done yet But I think we're getting close to having some consensus on it. So here's a Here's a example of something that you probably didn't think about until I just showed it to you if you go if you're like Oh, I have a string of HTML which is a TD I want to like to make a note out of it and you put it inside of a div Which is like the canonical way of just making nodes out of Strings actually that does not work So it doesn't work because the browser is like you cannot put a TR inside of a or TD inside of a div And this basically this problem happens when you do this, right? So every single time you do this jQuery looks at that that string And if we just did the naive solution it would break and you probably use this feature a lot in jQuery This is not the jQuery solution, but something like this is the solution go look for a TDs if you see a TD Go actually make a new string, which is the concatenation of a bunch of stuff and insert that into it This actually sucks. This is a terrible terrible thing If you look inside of jQuery, you'll see that we have a wrap map which basically knows for every single weird element What you have to wrap it in this is like Incredibly horrible But there's actually no way around it. There's no way to avoid this problem and What we actually want is fragment equals document that parts I could have I could have had a slide Which lists all the problems, but there's basically a large series of problems including things like There is a a tag in SVG if you see an a tag, what do you do? So like things you probably didn't think of and it's very easy for us to be like, oh SVG is a stupid idea like kill it Kill it like no, we actually can't right. We have to actually make this work in the browser There's also like script tags in SVG. There's a believe it or not MathML came up as a thing so When you actually start to look at how to do this without like a regex right jQuery uses a regex It works fine for our use cases, but then you have to actually standardize what exactly it means and in fact We want a standard we want a thing that actually describes exactly what the behavior is in all cases So we're actually working through this right now trying to get this in I think again. I think there's some consensus you can see Interestingly the vector for getting this feature in so I wanted this feature for a long time The vector for getting this feature in is that there's a there's an interest in having a template element and a template element Obviously cannot disallow a TR tag inside of the template because that would be massively unexpected so we needed to define We needed to define a parsing mode anyway that would support this and I said hey while we're at it Why don't we just finally implement this feature? And now you so you can see like template element parser changes implied context and again We're working our way through we started in May. We're now in mid-June It's working okay process is working so I Think the important question is if you say Who are these W3C guys? We have a crisis of confidence in them You have to ask yourself like who is the who are the people that are making the consensus? Who are the people who are responsible for making these decisions and why are why are we not in there? Why are we not there? So again, there's that that quote from that blog post standards committee should not be the ones who get to decide to invent the future Standards committees are not some weird distant thing. Why are we not them? Why are we not the ones inventing the future the process is actually built for us to do that? So why don't we do that? I want to close with a quote from Hillel actually he said if I am not for myself then who will be for me and if I am only for myself Then what am I and if not now when I think? We're finally getting to the point where the cutting edge is pulling away and the tail end is shrinking And now is the right time now is the right time for us to get in the future is coming Let us be part of it. Thank you very much. I think I have time for a few questions Like one or two, but we're gonna what we're gonna do is we're just gonna skip the break That's gonna happen right now so that we can stay more or less on schedule That doesn't mean you can't leave the room, but I mean you're just talking next so why would you do that? so One question two questions Maybe like a question with a simple answer like what's your middle name? You might not be able to pronounce it so so My company is having an issue with a custom selector that somebody is put in and I was wondering how jQuery responds to having custom selectors what they're doing to improve the acceptance of Custom selectors that aren't standard. I Can I'm not exactly sure what the question is, but I can answer questions about custom selectors and standards I'll say a thing and you'll tell me if I answer your question So one of the things that I've been working on recently is a big document that basically says why sizzle is not the same thing as query selector all And the reason for that is that I think from the spec authors perspective. It's like oh sizzle It's a selector engine like that's basically query selector all right and actually it's not really and so Custom selectors are actually one such thing right you can't just replace sizzle with query selector all because there's no custom selector So I've been working on a bunch of proposals for things like aliases That might allow us to have not in CSS proper, but just in the selector subset Or superset might let us have a way to say okay colon text is the same thing as input type equals text And basically jQuery would register a bunch of these aliases and possibly raw JavaScript ones Maybe we can get positional selectors in right there's a bunch of there's a bunch of things We would have to do to make qsa as powerful as jQuery selector engine And I'm actually working on that that's one of the projects that I worked on so There's basically three major projects other that are not part of JavaScript which are the two I talked about so far and the qsa why is qsa not the same thing or find all I guess now why it's find all not the same thing as as sizzle and Hope if I am successful and again these things take time. They're complicated We will be able to basically replace sizzle in some next generation of browsers with a bunch of Registration of things that are for custom stuff