SitePoint播客#50:jQuery:《忍者新手》

tech2023-12-20  62

Episode 50 of The SitePoint Podcast is now available! This week, Kevin Yank (@sentience) is joined by Earle Castledine (@mrspeaker) and Craig Sharkie (@twalve), co-authors of SitePoint’s new book, jQuery: Novice to Ninja. A complete transcript of the interviews is provided below.

SitePoint Podcast的 第50集现已发布! 本周,SitePoint的新书《 jQuery:Ninja的新人》的合著者Earle Castledine( @mrspeaker )和Craig Sharkie( @twalve )加入了Kevin Yank( @sentience )。 下面提供了采访的完整笔录。

下载此剧集 (Download this Episode)

You can also download this episode as a standalone MP3 file. Here’s the link:

您也可以将本集下载为独立的MP3文件。 这是链接:

SitePoint Podcast #50: jQuery: Novice to Ninja (MP3, 33.2MB)

SitePoint Podcast#50:jQuery:Ninja的新手 (MP3,33.2MB)

面试成绩单 (Interview Transcript)

Kevin: February 26th, 2010. SitePoint co-authors Earle Castledine and Craig Sharkie drop by to discuss the jQuery JavaScript library. I’m Kevin Yank and this is the SitePoint Podcast #50: jQuery: Novice to Ninja.

凯文: 2010年2月26日。SitePoint的合著者Earle Castledine和Craig Sharkie来讨论jQuery JavaScript库。 我是Kevin Yank,这是SitePoint播客#50:jQuery:Ninja的新手。

Today’s show is all about JavaScript. So whether you’re a JavaScript expert or you have always wanted to add JavaScript to your toolkit, today’s show is for you. We’ve got the two co-authors of SitePoint’s latest book, jQuery: Novice to Ninja, together to talk with us. We’ve got Earl Castledine who is known in web circles as Mr. Speaker. You can find him on Twitter @mrspeaker.

今天的节目全部关于JavaScript。 因此,无论您是JavaScript专家还是一直希望将JavaScript添加到您的工具箱中,今天的节目都适合您。 我们有SitePoint最新书《 jQuery:Ninja的新手》的两位合著者一起与我们交谈。 我们有伯爵·卡斯汀(Earl Castledine),他在网络界被称为议长先生。 您可以在Twitter @mrspeaker上找到他。

Earl is well known for his experiments bending web technologies into new shapes. His latest experiment, TurnTubeList, lets you take two playlists of YouTube videos and mix them back and forth like on a DJ turntable and the user interface is all done with JavaScript controlling the two Flash movies from YouTube, and it’s really impressive stuff. Check it out at TurnTubeList.com.

伯爵以将网络技术转变为新形状的实验而闻名。 他的最新实验TurnTubeList可让您获取YouTube视频的两个播放列表,并像在DJ转盘上那样来回混合它们,并且用户界面都是使用JavaScript控制YouTube上的两个Flash电影来完成的,这的确令人印象深刻。 在TurnTubeList.com上进行检查。

Craig Sharkie is known on Twitter as @twalve and Craig has been working for big names like AOL, Microsoft, Yahoo!, Ziff-Davis, and now he calls Atlassian home. He has been touring and speaking about JavaScript for years. He likes to stay he spoke about the “good parts” of JavaScript before Douglas Crockford did.

克雷格· 沙基( Craig Sharkie)在Twitter上被称为@twalve ,克雷格(Craig Sharkie) 曾为 AOL,微软,雅虎,齐夫·戴维斯(Ziff-Davis)等知名人士工作,现在他将Atlassian称为“家”。 他多年来一直在游览和谈论JavaScript。 他喜欢留下来,而道格拉斯·克罗克福德(Douglas Crockford)之前就只讲过JavaScript的“好部分”。

Guys, welcome!

大家好!

Both: Hey Kevin!

两者:嗨,凯文!

Kevin: This is a rare pleasure that I get to speak with two SitePoint authors in my time zone.

凯文(Kevin):我很荣幸能与时区的两位SitePoint作者交谈。

Earle: It’s a good time zone to be in I think.

厄尔:我认为这是一个很好的时区。

Kevin: Craig and Earle are both Australian. They’re both in Sydney at the moment. I’m in here in Melbourne, but wow, it doesn’t feel very far away compared to… Usually we get authors from America and Europe and all over the place, but it’s great to be able to showcase some Australian talent with this book.

凯文:克雷格和厄尔都是澳大利亚人。 他们俩现在都在悉尼。 我现在在墨尔本,但是,相比之下,感觉并不遥远​​……通常我们从美国和欧洲以及世界各地来找作者,但很高兴能够通过本书展示一些澳大利亚人才。

So this book, jQuery: Novice to Ninja, is it fair to say it’s a beginner’s guide to jQuery?

因此,《 jQuery:Ninja的新手》这本书,可以说这是jQuery的初学者指南吗?

Earle: I guess the title is a bit of a hint. Yes, it is beginner book, but it ramps up towards the end. So toward the end, everyone can have something to learn about jQuery.

厄尔:我想标题有点暗示。 是的,这是一本初学者的书,但它逐渐增加到结尾。 因此,到最后,每个人都可以了解jQuery。

Kevin: For those who don’t know in our audience, can someone describe what jQuery is?

凯文:对于那些在我们的听众中不了解的人,有人可以形容jQuery是什么吗?

Earle: Those who don’t know what jQuery is?

Earle:那些谁不知道jQuery是什么?

Kevin: (laugh) Exactly.

凯文:(笑)是的。

Earle: To the back of the class for you guys! jQuery is—well it’s the brainchild of John Resig. It’s a JavaScript library to help manipulate the DOM, basically. That’s jQuery’s chief feature, is being able to move stuff on a page. It’s features are – can select things on the page, like getting paragraphs and move them or flash them, or do anything that you can imagine to them and it has also got a neat Ajax helper library too. So there are sort of two parts to it, DOM manipulation and a cool Ajax library. Would you say that’s fair, Craig?

厄尔:你们大家来上课吧! jQuery是-它是John Resig的创意。 基本上,这是一个JavaScript库,可帮助您操纵DOM。 这是jQuery的主要功能,能够在页面上移动内容。 它的功能是–可以选择页面上的内容,例如获取段落并移动它们或对其进行闪烁,或者对它们执行您可以想象的任何事情,并且它还具有一个整洁的Ajax帮助器库。 因此,其中包括两部分:DOM操作和一个很棒的Ajax库。 你说这很公平吗,克雷格?

Craig: Yeah, definitely fair. It’s a really easy way for non-classic developers to get access to some of the features that would normally take a lot more effort than you can get by just picking up our book and starting from scratch.

克雷格:是的,绝对公平。 对于非经典开发人员来说,这是一种非常容易的方法,它们可以使用某些功能,而这些功能通常比仅从拿起书本并从头开始获得的工作量要大得多。

Kevin: What do you mean by non-classic developers?

凯文:非经典开发者是什么意思?

Craig: The language uses syntax which is very familiar to the design community through CSS. So you don’t have to worry about understanding a lot of the under-the-hood features of JavaScript before you can actually start using jQuery. So you will end up loving JavaScript and will want to get to know it a lot better, but you can get a lot of features happening really quickly just by simply plugging jQuery into your webpages and moving on from there.

Craig:该语言使用的设计语法通过CSS非常熟悉。 因此,在真正开始使用jQuery之前,您不必担心了解JavaScript的许多底层功能。 因此,您最终将爱上JavaScript,并希望更好地了解它,但是只需将jQuery插入网页并从那里继续前进,您就可以很快地实现许多功能。

Kevin: So jQuery adds this layer on top of the JavaScript language. It’s a layer that will be very familiar to people who come from a background of CSS?

凯文:所以jQuery在JavaScript语言的基础上增加了这一层。 对于那些来自CSS背景的人来说,这是一个非常熟悉的层吗?

Earle: That’s right. The way that you select things on the page is basically CSS selectors, so if you know how to style something then you know how to select it and then if you know, on the end, you put .hide, then—wooh!—it hides, and then put .fade—wooh!—it fades. So getting stuff working quickly, it’s really fun. It just makes it really fun to play with the page.

厄尔:对。 你在页面上选择事物的方式基本上是CSS选择器,所以如果你知道如何风格的东西,那么你知道如何选择它,然后,如果你知道了,就完了,你把.hide ,然后,呜!-IT隐藏,然后将.fade呜!)淡入淡出。 因此,让事情快速运行非常有趣。 玩这个页面真的很有趣。

Kevin: All right. That’s really where jQuery got its name. It was about getting a set of elements, a set of parts of the page based on a CSS query, right? But it’s really grown up from there. I mean, what are some of the parts of jQuery today that people don’t really know about?

凯文:好的。 这就是jQuery取名的地方。 这是关于获取一组元素,基于CSS查询的页面的一部分,对吗? 但是它确实是从那里长大的。 我的意思是,当今人们真正不了解的jQuery有哪些部分?

Earle: I think the custom event handling stuff is really powerful and a lot of people don’t end up going down that road where you can start setting up your own events to trigger, so you’re only writing code once and triggering them for multiple parts on the page. This does get quite, I guess, complex, compared to the stuff that you learn at the start, which is just making something zoom up and down. You can start building some sort of really industrial strength applications with the advanced features without dropping into JavaScript as much as you much as you’d need to. You’d need to write a heck of a lot of JavaScript to do the same thing.

厄尔:我认为自定义事件处理功能确实很强大,很多人并没有最终选择可以设置自己的事件来触发的方式,因此您只需编写一次代码并为它们触发即可页面上的多个部分。 与您一开始所学到的东西(只是使内容上下缩放)相比,这确实变得相当复杂。 您可以使用高级功能开始构建某种真正具有工业强度的应用程序,而无需尽可能多地使用JavaScript。 您需要编写大量JavaScript来完成相同的操作。

Craig: Also something you can do is you can extend the selector engine as well, so that— People who are familiar with CSS would be familiar with :hover or :last-child or :first-child, but with jQuery you can actually develop your own series of custom filters so the syntax to getting access to an element on the page in any sort of statement you want is really straightforward. That’s another feature of the language is that if you can think of an action, the first point of reference in the API is likely going to be that action. So if you want to hide something as Earle said, it’s not toHide or hideElement or some long syntax; it’s simply the word hide. So you find a selector, you add a single action to it, and you get a great response.

Craig:您还可以做的是扩展选择器引擎,以便-熟悉CSS的人会熟悉:hover或:last-child或:first-child ,但实际上,使用jQuery可以开发您自己的一系列自定义过滤器,因此以所需的任何形式访问页面中元素的语法非常简单。 该语言的另一个功能是,如果您可以想到一个动作,则API中的第一个参考点很可能就是该动作。 因此,如果您要像Earle所说的那样隐藏某些东西,那不是toHide或hideElement或某种长语法。 只是“ hide这个词。 因此,您找到了一个选择器,向其中添加了一个操作,并且得到了不错的答复。

Earle: I think the custom selector thing that Craig was talking about is really cool because, I think it was from the book that you made, is it below-the-fold selector?

厄尔:我认为Craig谈论的自定义选择器确实很酷,因为我认为这是从您所写的书中得出的,它是折叠式选择器吗?

Craig: Mm-hmm.

克雷格:嗯。

Earle: He’s made his own selector so instead of saying selecting .classname or h1, it was :belowthefold, I think it was. It would narrow it down to anything that was below the page fold. It was just a way that you could start selecting things like that wasn’t a part of the core jQuery selector engine.

厄尔:他做了自己的选择器,所以不用说选择.classname或h1 ,而是:belowthefold ,我认为是。 它将缩小到页面折叠以下的任何内容。 这只是您开始选择类似之类的事情的方式,它并不是核心jQuery选择器引擎的一部分。

Kevin: Wow, that’s really cool.

凯文:哇,那真的很酷。

Earle: Yeah, I liked that.

厄尔:是的,我很喜欢。

Kevin: Is it fair to say that once you start using jQuery, your JavaScript code ends up looking really different than from the code you would have written before?

凯文:可以公平地说,一旦您开始使用jQuery,您JavaScript代码最终就会看起来与之前编写的代码完全不同?

Earle: No… Hopefully, it looks better.

厄尔:不……希望它看起来更好。

Kevin: (laugh) Better is different.

凯文:(笑)更好是不同的。

Earle: You can’t separate the fact that if you got serious into writing jQuery and then in the end you want to learn how to write JavaScript properly. You can still write terrible JavaScript using jQuery.

厄尔:您无法分开这样一个事实:如果您认真地编写jQuery,那么最后您想学习如何正确编写JavaScript。 您仍然可以使用jQuery编写糟糕JavaScript。

There aren’t a lot of people writing terrible JavaScript because you can write such beautiful JavaScript. The only thing is that you stop reinventing the wheel to do things like being able to select elements cross-browser nicely. You let someone else worry about those kind of cross-browser issues, which is good.

编写可怕JavaScript的人并不多,因为您可以编写如此漂亮JavaScript。 唯一的事情是,您不再需要重新发明轮子,而是可以更好地跨浏览器选择元素。 您让其他人担心这种跨浏览器的问题,这很好。

Craig: And we were really keen to make sure that while the book focuses on jQuery that all the examples use best practice where possible, so that if you follow our examples by the time you finish the book, you should come out of it as a much better JavaScript programmer than you went in, even a better programmer than you intended to become.

Craig:我们非常希望确保在本书着重于jQuery的同时,所有示例都尽可能使用最佳实践,因此,如果您在完成本书时遵循我们的示例,那么您应该从本书中脱颖而出。比您加入JavaScript程序员好得多,甚至比您打算成为的更好。

Kevin: Yeah, that’s something we try to do with all SitePoint books, so good work guys, good work.

凯文:是的,这是我们尝试使用所有SitePoint书籍的方法,所以,好人,好工作。

Both: (laugh)

两者:(笑)

Kevin: Obviously jQuery is not the only JavaScript library out there.

凯文:显然,jQuery不是唯一JavaScript库。

Earle: No, I think it is. (laughing)

厄尔:不,我认为是。 (笑)

Kevin: (laughing) “I think you’ll find it is!”

凯文:(笑)“我想你会发现的!”

Craig: There’s one or two out there as well, yeah.

克雷格:还有一两个,是的。

Kevin: For you guys, it’s the only choice, though?

凯文:对你们来说,这是唯一的选择吗?

Earle: Now it is. I play with any new thing that ever comes out, ever, and try to use it in a production environment if I can get it past my bosses, but now I’ve got to the point where—okay, this is arguable—but jQuery has sort of won the library battle and that’s not 100% true because there’s other libraries concentrate on different… They’re starting to develop their own niches. In terms of speed, jQuery is not the fastest library out there.

厄尔:现在是。 我会尝试任何可能出现的新事物,如果可以超过老板,请尝试在生产环境中使用它,但是现在我要说到了-好吧,这是有争议的-但是jQuery赢得了图书馆之战,但这并不是100%正确,因为还有其他图书馆专注于不同的图书馆……他们开始发展自己的利基市场。 就速度而言,jQuery并不是目前最快的库。

Craig: It’s the second fastest and that’s arguable.

克雷格:这是第二快的,这是有争议的。

Earle: Yeah.

厄尔:是的。

Craig: What will generally happen— I think one reason why jQuery is really valuable to us as developers is that there’s a massive community. So it’s not just the strength of the language itself, there’s also the strength of the community behind the language. For example, I met up with John Resig in WebStock last week in Wellington and we were talking about the fact that a competitor library will come out with a claim and John will go and check out to make sure the claim is correct or incorrect, and if he finds out that someone is actually able to make a claim that their library does X better than jQuery, then he’ll change the way jQuery works to match or better that competitor library.

Craig:通常会发生什么—我认为jQuery之所以对我们作为开发人员真正有价值的原因之一是有一个庞大的社区。 因此,这不仅是语言本身的优势,还有语言背后的社区实力。 例如,上周我在惠灵顿在WebStock上与John Resig会面,我们谈论的事实是竞争对手的图书馆会提出索赔,John会去检查以确保索赔正确或不正确,并且如果他发现某人实际上可以宣称自己的库比jQuery的X更好,那么他将改变jQuery匹配或优于该竞争对手库的方式。

Kevin: There are a lot of gray areas on this stuff though. When you talk about performance, I mean do you judge the performance by how fast it is on the fastest browser or how fast it is on the slowest browser?

凯文:虽然这些东西上有很多灰色区域。 当您谈论性能时,我是说您是根据最快的浏览器上的速度或最慢的浏览器上的速度来判断性能的?

Earle: They usually have a big matrix setup to show you how it runs over every browser. The performance issue is— Okay, for me, it’s become less and less. I haven’t had— Even when you’re making crazy ridiculous widgets, where things start bogging down, it’s only when you’re doing something really quite crazy that you care anymore when you start talking about milliseconds for 15,000 operations, it’s like, well, great, the other one’s 5 milliseconds faster, but the end user’s not going to notice it, in a lot of cases. It depends, of course what you’re doing.

厄尔:他们通常具有大型矩阵设置,以向您展示其如何在每种浏览器上运行。 性能问题是-好的,对我来说,它变得越来越少了。 我还没有,即使您在制作疯狂的荒谬小部件时,事情开始陷入困境,也只有当您在做非常疯狂的事情时,您才开始在谈论15,000个毫秒的操作时就在乎,就像,很好,很好,另一个人快了5毫秒,但是在很多情况下,最终用户不会注意到它。 当然,这取决于您在做什么。

But also other libraries concentrate more on classical object-oriented classes and making these kind of frameworks where you can extend classes in a classical sense, object-oriented programming, which jQuery steers away from. If that’s what you’re looking for in a library, then perhaps you should check out the other libraries.

但是其他库也更多地关注经典的面向对象的类,并建立了这样的框架,您可以在经典的意义上扩展类,即jQuery避开的面向对象的编程。 如果这是您在库中要查找的内容,那么也许您应该查看其他库。

Kevin: I want to talk about jQuery from two different perspectives. The first is for someone who doesn’t know JavaScript at all. I mean, we mentioned earlier that jQuery provides a welcoming set of features for people who know CSS and can smooth out some of the difficulty and the strangeness of JavaScript when you first encounter the language. Would you actually recommend someone who doesn’t know JavaScript learning it with jQuery and then exploring the language from there?

凯文:我想从两个不同的角度谈谈jQuery。 首先是针对完全不了解JavaScript的人。 我的意思是,我们前面提到过,jQuery为那些了解CSS的人提供了一套受欢迎的功能,当您初次接触该语言时,可以消除JavaScript的一些困难和陌生之处。 您是否真的会推荐一个不了解JavaScript的人使用jQuery学习然后从那里探索语言?

Earle: Sure.

伯爵:当然。

Craig: Definitely, definitely.

克雷格:绝对,绝对。

It’s one of those things that is so easy to use and it’s so easy to use the library well, that you can’t help but try and push yourself and your access to JavaScript. Before you know it, you will be doing fantastic manipulations of the DOM it will be without any classical training.

这是易于使用且易于使用的库之一,以至于您不禁要努力推动自己以及对JavaScript的访问。 在不知不觉中,您将进行DOM的出色操作,而无需任何经典培训。

Earle: And it’s basically, again, it smoothes over the stuff that’s really—can I say, crap? I’m going to say crap—about JavaScript in the browser. If first thing that someone coming from no experience in JavaScript that has to do is write a nice cross browser getElementByClassName, we’ve already lost them—they’re gone. They don’t want to do that. They just want to be able to get elements by class name and then figure out what they want to do with it, and when you want to do something that’s not in jQuery, that’s when you go “Well, how should I do this?” And usually that answer is JavaScript. So you can even sort of blurs the line between when you start actually getting into the JavaScript, if that makes sense?

厄尔:基本上,它又可以使真正的东西变得平滑—我可以说,胡扯吗? 我要说废话,关于浏览器中JavaScript。 如果没有JavaScript经验的人要做的第一件事就是编写一个不错的跨浏览器getElementByClassName ,那么我们已经迷失了它们,它们已经消失了。 他们不想那样做。 他们只是希望能够通过类名获取元素,然后弄清楚它们要做什么,而当您想做jQuery中没有的事情时,那就是当您“嗯,我应该怎么做?” 通常,答案就是JavaScript。 因此,即使您真正开始使用JavaScript,您甚至可以模糊两者之间的界限?

Kevin: Yeah. And the other perspective is because everyone out there who is an experienced JavaScript developer goes through this period where they built up their own libraries, their own code base that they know and they trust, and they understand how every line of it works and they know if something doesn’t work they’re going to be able to fix it because they built the thing in the first place. Obviously, the two of you have each gone through your own, um, journey and it ended with “I’m going to throw away my own getElementByClassName, I’m going to throw away my own events compatibility layer and I’m going to trust that jQuery has the best implementation.” How did you get there?

凯文:是的。 而另一种观点是,因为有经验丰富JavaScript开发人员的每个人都经历了这段时期,他们建立了自己的库,他们知道并信任的代码库,并且了解了库的每一行是如何工作的,并且知道了如果某件东西行不通,他们将能够修复它,因为他们首先制造了它。 显然,你们两个都经历了自己的旅程,结果以“我将放弃自己的getElementByClassName ,我将放弃自己的事件兼容性层而结束相信jQuery具有最佳的实现。” 你是怎么到达那里的?

Earle: Mine was called E-jax, for Earl’s Ajax Library. Yeah, that didn’t last very long. It lasts up to the point where you use it in a project that you realize you’ve made errors in it and then you should go back and fix it in every project you’ve used it in, and then you don’t, and then you go “Someone else should be taking care of these fundamentals, not me.”

伯爵(Earle):我的伯爵的伯爵阿贾克斯图书馆(Ejal Library)被称为E-jax。 是的,持续时间不长。 持续到您在项目中使用它时,才意识到自己在其中犯了错误,然后应该回去并在使用过的每个项目中对其进行修复,然后再不使用它,并且然后您转到“其他人应该照顾这些基本知识,而不是我。”

Craig: That’s the thing in jQuery it provides us with a really strong set of fundamentals, but it’s got a fantastic plug-in function as well so that if you can’t find it in the core language—which is quite likely, because it’s nice and clean and fast—you can build it in the plug-in and then you quickly find that all you’ve done is transferred your old library into the new syntax of jQuery. So you’re still out there, you’re still able to make some crazy functions and you can rely on yourself and distribute to the community, but it’s using a foundation that you know that if you walk away from a job, the next jQuery developer coming in behind you can read your code straight away and that means that you can expand the team quickly, you can move around quickly, you can move one job to the next and know that you’ll be able to have a really slow barrier of entry because it’s based on something we all know and love.

Craig:这就是jQuery,它为我们提供了非常强大的基础知识,但是它也具有出色的插件功能,因此,如果您无法在核心语言中找到它,则很有可能,因为美观,干净,快捷—您可以在插件中构建它,然后您很快发现所做的一切就是将旧库转移到jQuery的新语法中。 所以您仍然在那儿,仍然可以执行一些疯狂的功能,并且可以依靠自己并分发给社区,但是它使用的基础是您知道如果您辞职,那么下一个jQuery紧随其后的开发人员可以立即阅读您的代码,这意味着您可以快速扩展团队,可以快速迁移,可以将一项工作转移到下一项,并且知道您将能够遇到一个非常缓慢的障碍入门,因为它基于我们都知道和喜欢的东西。

Kevin: What is jQuery like to debug? If it does something you don’t expect it to do and you have to drill into that black box and see what’s going on, what’s that like?

凯文: jQuery调试像什么? 如果它执行了您不希望执行的操作,并且您必须钻入该黑匣子并查看发生了什么,那是什么感觉?

Earle: You mean if there’s a bug in the source code of jQuery?

厄尔:您的意思是说jQuery的源代码中是否有错误?

Kevin: Whether it’s a bug or just something you didn’t understand.

凯文:无论是错误还是只是您不了解的东西。

Earle: Generally you never have to actually get to the jQuery library to look at it unless you’ve done something pretty crazy. Usually the debugging follows how you’d normally debug. You break into functions or alert if you have to and you figure out what’s going on. You generally know you’ve done something stupid if the error’s occurring in the code that’s inside the jQuery Library. Not something to stupid, but you go “Oh, hang on, I passed in something that’s not expected.” Usually it’s quite a high level thing. But getting into the code – if you seriously mean getting into the jQuery code, it’s very beautiful JavaScript code.

厄尔:通常,除非您做了相当疯狂的事情,否则您实际上不必真正进入jQuery库即可查看它。 通常,调试遵循您通常的调试方式。 您可以闯入功能或在必要时发出警报,然后了解发生了什么。 您通常都知道,如果jQuery库中的代码中发生了错误,那么您所做的事情就是愚蠢的。 没什么愚蠢的,但您会选择“哦,等等,我传递了一些意想不到的内容。” 通常这是相当高级的事情。 但是,进入代码–如果您认真地意味着要进入jQuery代码,那是非常漂亮JavaScript代码。

Craig: Yeah.

克雷格:是的。

Earle: If you want to have a look. I mean I love going through the source code of that. That’s why I’ll always keep it the non-minified version until it goes to production for QA.

厄尔:如果您想看看。 我的意思是我喜欢浏览该源代码。 这就是为什么我会一直将其保留为非缩小版本,直到将其用于质量检查为止。

Kevin: So you get the feeling that for something to be this efficient and this fast that they had to do some things in some really non-obvious ways and if you dig in to that code, you’re going to get lost really quickly because rather than doing things the way that makes beautiful code, they’re doing things the way that makes fast code. Is that true at all?

凯文:因此,您会感到,对于这样一种高效且如此快速的东西,他们必须以某些非显而易见的方式来做一些事情,如果深入研究该代码,您将很快迷失,因为他们不是以制作精美代码的方式来做事,而是以制作快速代码的方式来做事。 那是真的吗?

Craig: There’s a lot of beauty in the speed of the code as well. So if anything, by looking at the source code itself, you’ll quickly become a better programmer in the way you lay out your non-jQuery JavaScript.

Craig:代码的速度也有很多优点。 因此,如果有的话,通过查看源代码本身,您将可以通过以非jQuery JavaScript布局的方式Swift成为更好的程序员。

Earle: It’s not … there’s no weird tricks in there. There’s tricks, but they haven’t gone … it’s not all obfuscated and weird. It’s very readable.

厄尔:不是……那里没有诡异的把戏。 有花样,但还没有消失……并非全都被混淆和奇怪。 这是非常可读的。

Craig: Yeah, and often the tricks are things that you might not necessarily do the first time you’re writing JavaScript there so you might target a browser and you’ll get a great response. But they’ve made their code flexible to accommodate the cross-browser issues so that if you start looking at their code you start learning at first practice how to do better code.

Craig:是的,而且很多窍门通常是您第一次在那儿编写JavaScript时不一定要做的事情,因此您可以将目标放在浏览器上,并且会得到很好的响应。 但是他们已经使他们的代码更加灵活,以适应跨浏览器的问题,因此,如果您开始查看他们的代码,那么您将首先学习如何制作更好的代码。

Earle: But you usually don’t have to get into it.

厄尔:但是您通常不必参与其中。

Craig: Very, very rarely.

克雷格:非常非常罕见。

Kevin: All right.

凯文:好的。

Earle: You can figure out in your own code what’s going on.

Earle:您可以在自己的代码中弄清楚发生了什么。

Craig: And often you’ll— If you spend any time in the IRC channel, you’ll start seeing that there’s a lot of people out there who are quick to help. If you find something which comes up as a bug, that you think is a bug, then ask the community and the community will often provide with a quick answer.

Craig:通常,如果您花任何时间在IRC频道中,就会开始发现那里有很多人可以Swift提供帮助。 如果您发现某个错误是您认为是错误,请问社区,社区通常会提供快速答案。

Kevin: So let’s talk about the community. JQuery, the first name that comes to mind when you hear jQuery is, as you said, John Resig, the creator of the library. How big a part of the community is John? Is he still the sole man responsible for jQuery, or has it become a community effort?

凯文:让我们来谈谈社区。 正如您所说,JQuery是您听到jQuery时想到的第一个名字,它是该库的创建者John Resig。 约翰在社区中有多重要? 他仍然是负责jQuery的唯一人,还是已经成为社区的工作?

Earle: The ‘soul man’…

厄尔: “灵魂人物”…

Craig: (laughing)

克雷格:(笑)

Kevin: (laughing)

凯文:(笑)

Craig: It’s definitely a community effort but it’s good to know that there’s someone with a hand on the tiller still. So there’s a growing team of developers out there who are committing constantly to the source code, but there is one person who knows what’s going on who loves it so dearly that he’s happy to put his name to it.

克雷格(Craig):这绝对是社区的努力,但是很高兴知道有人仍然在分er上。 因此,有越来越多的开发人员团队不断致力于源代码,但是有一个人知道发生了什么事,因此非常喜欢它,以至于他很乐意将自己的名字命名。

Earle: It’s pretty crazy. So many times on the dev lists I’ve submitted something and then 10 minutes later there’s a reply from John Resig, and you go “Are you awake all the time?”

厄尔:太疯狂了。 在开发人员列表上,我提交了很多次,然后10分钟后,约翰·雷西格(John Resig)给出了答复,然后您说:“您一直都醒着吗?”

Kevin: You guys got to meet John Resig recently at WebStock in New Zealand, right?

凯文:你们最近在新西兰的WebStock见了John Resig,对吗?

Craig: Yeah.

克雷格:是的。

Earle: I met him over in Sydney. We had a jQuery meet-up and he came along to that. It was really good.

厄尔:我在悉尼见过他。 我们举行了一次jQuery聚会,他也加入了。 真的很好。

Kevin: So did the subject come up that you guys are just about to publish a “jQuery Ninja” book and he has a “JavaScript Ninja” book coming up, were there any hard feelings there?

凯文:是不是这个话题突然出现了,你们即将出版一本“ jQuery忍者”书,而他也即将出版一本“ JavaScript忍者”书,那里有什么难受的感觉吗?

Earle: I skirted around that issue, yeah.

厄尔:我绕过这个问题,是的。

Craig: I am worried about that issue, yeah.

克雷格:我担心这个问题,是的。

Kevin: What’s he like?

凯文:他怎么样?

Earle: Really nice, nice guy.

厄尔:真的很好,好人。

Craig: Yeah, very unassuming. He’s like his library. He just knows what he’s doing. One of the things I thought was quite strange that he was saying that he barely really codes anymore, he doesn’t build product sites with his library. He spends his time building his library.

克雷格:是的,很张扬。 他就像他的图书馆。 他只知道自己在做什么。 我认为其中一件很奇怪的事是,他说自己几乎不再编写代码了,他不使用自己的库建立产品站点。 他花时间建立自己的图书馆。

Kevin: Mmm. So that’s where I guess the community becomes really important.

凯文:嗯。 所以我认为社区真的变得很重要。

Earle: Definitely. It’s not just John anymore. There’s a whole bunch of the core guys in the jQuery team now. So I think that it is probably getting out, getting away from just John. In fact, didn’t he just recently have to make it into the foundation?

伯爵:当然。 不再只是约翰了。 现在,jQuery团队中有很多核心人员。 因此,我认为这很可能正在摆脱约翰。 实际上,他不是最近才必须加入基金会吗?

Craig: The foundation, yeah.

克雷格:基金会,是的。

Earle: So if John gets hit by a bus then jQuery keeps going; which is kind of important.

厄尔:所以,如果约翰被公共汽车撞了,那么jQuery就会继续前进; 这很重要。

Kevin: Craig, in your bio on the book you talk about how back in the 90s you used to talk about the “good parts” of JavaScript versus the not-so-good parts, and that’s something Douglas Crockford from Yahoo! has made a career around now.

凯文:克雷格(Craig),在您的书中,您会谈到90年代以前谈论JavaScript的“好部分”与不太好的部分,这就是Yahoo的Douglas Crockford! 现在已经有事业了。

Craig: Yes.

克雷格:是的。

Kevin: How important is that distinction these days once you use something like jQuery? I suppose it leads you towards parts of JavaScript to use them more and to ignore parts. Does jQuery provide a guiding force towards those good parts of JavaScript or is it still a minefield out there?

凯文:当您使用jQuery之类的东西时,这种区别现在有多重要? 我想它会引导您进入JavaScript的各个部分,以更多地使用它们而忽略部分。 jQuery是为JavaScript的这些优秀部分提供了指导力量,还是它仍然是一个雷区?

Craig: JavaScript itself is still a minefield and it will continue to be so, unfortunately. There needs to be— Because of the way that JavaScript is so ubiquitous with the way the Web is being built, there needs to be maintained a strong sense of backwards compatibility. So a lot of the code that we’re seeing growth in the ECMAScript, it’s not in changes to the way code used to work but it’s in building additional features for us to use.

Craig: JavaScript本身仍然是一个雷区,不幸的是,它将一直如此。 必须存在-由于JavaScript在构建Web的方式中无处不在,因此需要保持强烈的向后兼容性。 因此,我们看到的很多代码都在ECMAScript中得到了增长,这不是在更改代码的工作方式,而是在构建供我们使用的其他功能。

Earle: So all the bad stuff’s still there.

厄尔:所以所有的坏东西仍然存在。

Craig: That’s it, yeah.

克雷格:就是这样,是的。

Earle: You can still make atrocious JavaScript with or without jQuery.

厄尔:无论有没有jQuery,您仍然可以制作糟糕JavaScript。

Kevin: But hopefully you’ll reach for a jQuery feature before you’ll reach for a JavaScript feature.

凯文:但是希望您先获得jQuery功能,再获得JavaScript功能。

Craig: Yes.

克雷格:是的。

Earle: And you’ll also find that especially when you start using plug-ins that you start looking at the code of plug-ins and if they’re good plug-ins you start seeing good code as well. I’ve found lots of little tips like that where I went “Oh, that’s nice, a nice little way to do it” from a good plug-in.

Earle:而且您还会发现,特别是当您开始使用插件时,您开始查看插件的代码,如果它们是好的插件,那么您也将开始看到好的代码。 我发现了很多小技巧,例如,我从一个好的插件中获得了“哦,这很好,一个不错的小方法”。

Kevin: So it goes without saying that the core code of jQuery is all good. Are there good parts and bad parts of jQuery is what I’m wondering? Are there plug-ins to be avoided?

凯文:不用说,jQuery的核心代码都很好 。 我想知道jQuery的好坏部分吗? 是否有应避免的插件?

Earle: Plug-ins to be avoided? Oh there’s some terrible plug-ins.

厄尔:避免使用插件? 哦,有一些糟糕的插件。

Craig: If you see a plug-in that’s advertised on jQuery’s site, then you can trust it.

Craig:如果您看到一个在jQuery网站上发布的插件,那么您可以信任它。

Kevin: Really?

凯文:真的吗?

Earle: But still research.

厄尔:但仍在研究。

Craig: Exactly. You still have to research the plug-in. You still have to make sure that it suits your purpose. It’s like you’re allowing another developer to put his code in your website. So you’ve got to do it with a sense of not trepidation but you’ve got to be really aware of what’s going on.

克雷格:是的 。 您仍然需要研究插件。 您仍然必须确保它适合您的目的。 就像您允许其他开发人员将其代码放入您的网站一样。 因此,您必须有一点不惧怕的感觉,但是您必须真正了解正在发生的事情。

Kevin: Yeah, it’s like giving someone the keys to your car. You need to make sure you know who they are and that they’re going to bring it back.

凯文:是的,就像给别人您的车钥匙一样。 您需要确保您知道他们是谁,以及他们将把它带回来。

Both: Exactly.

两者:完全正确。

Kevin: Speaking of jQuery plug-ins, do you guys have some favorites, some ones that aren’t so well-known that you’d like to talk about?

凯文:说到jQuery插件,你们有一些喜欢的东西,有些不是您想谈论的那么出名吗?

Craig: I’ve got a fantastic one that I built for Twitter.

克雷格:我有一个很棒的为Twitter开发的。

Kevin: Well, okay, it’s your own plug-in so that’s kind of cheating but go on, tell us about your plug-in.

凯文:好吧,这是您自己的插件,这有点作弊,但请继续介绍一下您的插件。

Craig: It looks exactly like a standard action from jQuery. You simply find a selector, tell it to be a Twitter and it fills up that selector with tweets. So it’ll take a username and will go to the stream and access the Twitter stream and just fill up the page. It uses the features of jQuery so that you get animation and it’s the seamless Ajax tie-ins so that you can sit there all day and watching the stream pass you by.

Craig:看起来就像是jQuery的标准动作。 您只需找到一个选择器,告诉它是一个Twitter,它就会用推文填充该选择器。 因此,它将使用一个用户名,然后转到该流并访问Twitter流,然后填写页面。 它使用了jQuery的功能,因此您可以获得动画,并且它是无缝的Ajax绑定,因此您可以整天坐在那里,看着流经过。

Kevin: That’s really cool. You talked about generic JavaScript libraries versus specific JavaScript libraries and I think jQuery started quite specific. It solved one real problem when it initially began but it has grown to very much be a generic library, but people are building specific libraries as jQuery plug-ins now.

凯文:那真的很酷。 您谈到了通用JavaScript库与特定JavaScript库之间的关系,我认为jQuery开始时是非常特定的。 它最初开始时解决了一个实际问题,但现在已经发展成为一个通用库,但是现在人们正在构建特定的库作为jQuery插件。

Earle: Like what?

厄尔:喜欢什么?

Kevin: Well, like Craig’s Twitter plug-in. That’s something that previously you would have downloaded a JavaScript file with no dependencies and it would have had its own event handling code in it and its own DOM manipulation code in it and nowadays people are building on top of the jQuery foundations.

凯文:好吧,就像克雷格的Twitter插件一样。 以前,您曾下载过一个没有依赖关系JavaScript文件,并且该文件中拥有自己的事件处理代码以及其自己的DOM操作代码,而如今,人们正在jQuery基础之上进行构建。

Craig: Yeah, we do it here at Atlassian. We’ve got a library called AUI, which is the Atlassian User Interface and it’s exactly that, it’s as a base we’ve got jQuery but on the top we’ve got specific functions which suit our products.

克雷格:是的,我们在Atlassian做到了。 我们有一个名为AUI的库,它是Atlassian用户界面,正是这样,它是我们拥有jQuery的基础,但最顶层的是我们有适合我们产品的特定功能。

Kevin: So is there still a space— If you guys have the choice between a jQuery plug-in and a raw JavaScript library, are you likely to look at the JavaScript library these days if they do the same thing?

凯文:还有一个空间-如果你们可以在jQuery插件和原始JavaScript库之间进行选择,那么如果这些天他们做同样的事情,您是否有可能会看一下JavaScript库?

Earle: Do you know, I still— Usually if I’m just coding, I’ve got a little idea, I’ll often just code it up just straight in JavaScript while I’m just prototyping it and getting it up, but I find that starting with j— I mean you get so used to the convenience of it that you do plug it in there, but that’s not to say you’re always going to want to do that. If you’re looking to keep the smallest code base possible, keep things running, like you said before, it is a layer. You’re putting a layer on top of what you’re doing. If you don’t want that layer, then sure, there’s nothing wrong with writing your own still, but don’t tell your boss because they’ll know it takes longer.

厄尔:您知道吗,我仍然会-通常,如果我只是编码,我会有一个小主意,我通常会直接在JavaScript中对其进行编码,而我只是对其进行原型设计并对其进行编码,但是我发现从j开始-我的意思是您已经习惯了它的便利性,可以将其插入其中,但这并不是说您总是想这样做。 如果您希望保持最小的代码库,则可以像前面所说的那样保持运行状态。 您正在做的事情上放一层。 如果您不想要该层,那么可以肯定,编写自己的静止图像没有任何问题,但是不要告诉老板,因为他们会知道这需要更长的时间。

Craig: The other thing that if you do end up ducking back in every now and again to the JavaScript like Earl and I both do, is you start to get a sense of the fact that if you’re writing a selector in JavaScript as opposed to in jQuery it takes a long time to write, and that gives you a sense of understanding that what jQuery is about to do might start to be slow and it sort of gives you an alarm bell that when you’re making this like you should really look at the way you’re constructing it so you get the optimal performance out of it.

Craig:如果您确实像Earl和我俩一样时不时地回缩到JavaScript,另一件事就是您开始意识到,如果您使用JavaScript编写选择器而不是要在jQuery中编写代码需要花费很长时间,这使您了解到jQuery即将执行的操作可能会开始变慢,并且它给您敲响了警钟,当您像这样做时应该真正看一下您构建它的方式,以便从中获得最佳性能。

Kevin: So it’s not magic. If it would be a slow thing for you to implement, chances are it’s a slow thing for jQuery to do.

凯文:所以这不是魔术。 如果对您来说实施起来很慢,那么jQuery可能会很慢。

Earle: Yeah, nothing’s magic.

厄尔:是的,没什么神奇的。

Craig: But it’s becoming slightly more magical all the time.

克雷格:但是它一直在变得越来越神奇。

Kevin: Yeah, I’m sure there are some good ideas in jQuery that you wouldn’t necessarily think of and therefore you get the advantage of those optimizations but that’s a good cautious place to start with. Maybe jQuery isn’t magic.

凯文:是的,我确定您不一定会想到jQuery中的一些好主意,因此您可以利用这些优化的优势,但这是一个非常谨慎的地方。 也许jQuery不是魔术。

Craig: Well, if you pretty much— Maybe you can start off thinking that it’s magic but if you’re a real nerd then you’d never ever trust magic. So you’re walking a fine line doing it.

克雷格:好吧,如果您非常喜欢-也许您可以一开始就认为这是魔术,但是如果您是一个真正的书呆子,那么您永远不会相信魔术。 这样您就可以做到这一点。

Kevin: So what’s going on with jQuery at the moment? I know 1.4 is sort of just out as we record this.

凯文:那么现在jQuery是怎么回事? 我知道1.4在我们记录下来时才刚刚结束。

Craig: Yeah, 1.4 actually has came out. It came out Thursday night or Friday night last week.

克雷格:是的,实际上1.4已经问世了。 上星期四晚上或星期五晚上出来了。

Kevin: Yeah. So … what’s exciting and new in 1.4 and what’s coming in jQuery that you guys are looking forward to?

凯文:是的。 因此……你们期待着1.4中的令人兴奋和新的东西以及jQuery中的新东西吗?

Earle: I want to see what they’re doing with the mobile stuff. I think they’re talking about getting a specific jQuery mobile build and targeting sort of mobile platforms. I think it seems it’s got a master plan there. I’m keen to see what that master plan is. It’s an interesting space. It’s a space that I’m a fan of at the moment so that’s what I’m excited about, what’s coming up.

厄尔:我想看看他们在使用移动设备。 我认为他们正在谈论获取特定的jQuery移动版本并定位某种移动平台。 我认为似乎那里有一个总体规划。 我很想知道那个总体规划是什么。 这是一个有趣的空间。 目前,我是这个空间的粉丝,这正是我感到兴奋,即将发生的事情。

Kevin: Craig?

凯文:克雷格?

Craig: Coming up, like Earl was talking about, but one of the things that I find interesting in the mobile space is that they’re not talking about cutting browsers out of jQuery. They’ve got jQuery to a point now where they know that an optimization that I need to do for IE7 will still be of benefit to a compliant browser. So they’re not looking to move away from any different platform or browser, they’re looking at making the entire library itself better at each step, and because they’re, in 1.4, they really strengthened the live action so where before you would do a click, now you’re doing a live click and it means that you’re delegating, which increases the speed of the browser’s response. Based on the strength of that, they’ve actually introduced a new action called ‘delegate itself’ and delegate allows you to do the same functions as live but to do it in only a section of the page so it cuts down the DOM that you’re looking through, and you’re getting fantastic response from the browser on all the different platforms.

Craig:像伯爵所说的那样出现,但是我在移动领域发现的一件有趣的事是他们并不是在谈论将浏览器从jQuery中剔除。 现在他们有了jQuery,他们知道我需要为IE7进行的优化仍将使兼容的浏览器受益。 因此,他们不想离开任何其他平台或浏览器,而是希望在每个步骤上使整个库本身变得更好,并且因为它们在1.4中确实增强了实时操作,因此会进行一次点击,现在您正在进行实时点击,这意味着您正在委派任务,这提高了浏览器响应的速度。 基于这种优势,他们实际上引入了一个名为“代理本身”的新动作,委托使您可以执行与live相同的功能,但只能在页面的一部分中执行,因此可以缩减您所使用的DOM。正在浏览,并且您在所有不同平台上的浏览器中都获得了出色的响应。

Kevin: Now you lost me there. I don’t know what these live actions are. Do you think you could take it a step back and describe that in more detail?

凯文:现在你在那里丢了我。 我不知道这些现场表演是什么。 您认为您可以退后一步,更详细地进行描述吗?

Craig: Yeah, actions are simply the things that we’re doing with jQuery so…

Craig:是的,动作只是我们使用jQuery所做的事情,所以…

Kevin: Yeah, so like ‘hide’ before.

凯文:是的,就像以前的“隐藏”一样。

Craig: Exactly, like hide. Or like click or mouseover or mouseenter, but due to some browser variations, we never used to have that full access to all the different functions that you would normally expect. So you couldn’t do mouseenter through a live action.

克雷格(Craig):确实,就像皮革一样。 或像单击,鼠标悬停或鼠标进入一样,但是由于浏览器的某些变化,我们从来没有像以前那样完全拥有对所有不同功能的完全访问权限。 因此,您无法通过实时操作进行鼠标输入。

Earle: Wait, were you asking what live was?

厄尔:等等,你是在问什么生活吗?

Kevin: Yeah!

凯文:是的!

Earle: Oh yeah, that was just… okay, so imagine if you wanted to make every paragraph on your page, um, alert an annoying popup when you clicked on it, and you’re like $('p').click and alert("Hey, how are going?"). It’s like that?

厄尔:哦,是的,只是……好吧,所以想象一下,如果您想在页面上制作每个段落,嗯,当您单击它时提醒一个令人讨厌的弹出窗口,就像$('p').click和alert("Hey, how are going?") 。 就像那样?

Kevin: Yeah.

凯文:是的。

Earle: That would be great, every paragraph on your page would – you’d click on it, it would pop up and pop up, “Hey, hey! That’s great.”

厄尔:太好了,页面上的每个段落都会-您单击它,它就会弹出并弹出,“嘿,嘿! 那很棒。”

Craig: The problem comes in when if you added a paragraph to your page after the function’s been run initially…

Craig:问题是当函数最初运行后,如果您在页面中添加了一个段落…

Kevin: Right.

凯文:对。

Craig: …your paragraph doesn’t know about the function that the other paragraphs are all using. With live, the live action works off the document itself and so any paragraph, in that case, any paragraph which is added to the document, it will then get the power of the methods of the other paragraphs are using.

Craig: …您的段落不了解其他段落都使用的功能。 使用live时,实时操作将在文档本身上起作用,因此任何段落(在这种情况下,即添加到文档中的任何段落)都将获得其他段落所使用方法的强大功能。

Kevin: So live events provide a continual, a convenience where new event handlers are continually applied automatically to elements that are added to the document on the fly. So what’s new in 1.4?

凯文(Kevin):因此,现场活动提供了连续的便利,新的事件处理程序会自动不断地自动应用到动态添加到文档中的元素上,从而为您提供了连续的便利。 那么1.4中有什么新功能?

Earle: That was there before. They really fixed it up for 1.4.

厄尔:以前在那里。 他们确实将其修复为1.4。

Craig: They made it faster and they’ve opened it up to more events.

克雷格(Craig):他们加快了速度,并为更多活动打开了大门。

Kevin: Yeah, okay. That’s cool.

凯文:是的,好的。 这很酷。

Earle: A lot of people, that was their favorite part of 1.4, I think. Like, “Thanks! You’ve finally made the live work perfect.”

厄尔:很多人,我认为这是1.4中最喜欢的部分。 就像,“谢谢! 您终于使现场工作变得完美了。”

Craig: You can still write a click as an action but you have to be certain that the selector that you’re using will be available when the function is called and that it won’t change afterwards.

Craig:您仍然可以将单击作为操作来编写,但是必须确保正在使用的选择器在调用函数时可用,并且以后不会更改。

Kevin: Yeah.

凯文:是的。

Craig: Now, they’ve tweaked live to an extent that you don’t have to worry about it anymore, so you can get to a point now where the click as a native action by itself almost can be deprecated because you can just use live.

克雷格:现在,他们已经对直播进行了调整,以至于您不必再担心它了,因此,您现在可以避免使用原生动作本身就几乎可以忽略点击,因为您可以使用生活。

Kevin: So at this point, is jQuery so good that there’s nothing annoying about it?

凯文:因此,在这一点上,jQuery是如此出色,以至于没有什么烦人的吗?

Craig: No!

克雷格:不!

Earle: No…! Otherwise they would stop developing it.

厄尔:不……! 否则他们将停止开发它。

Kevin: (laughing) So what annoys you about jQuery?

凯文:(笑)那么,让您烦恼的是jQuery吗?

Earle: Well, to me—we’ve gone back to your thing—I like things being not abstracted away; I like to see where things are. So the convenience for me is also annoying that I’m giving up some of my control to it. But the convenience is well worth it.

厄尔:好吧,对我来说-我们已经回到您的问题上了-我喜欢没有被抽象化的事物。 我喜欢看东西在哪里。 因此,给我带来的便利也很烦人,我放弃了对它的控制。 但是便利是值得的。

Kevin: And I think that stops a lot of developers from adopting something like jQuery.

凯文:我认为这阻止了很多开发人员采用jQuery之类的东西。

Craig: Yep. Definitely.

克雷格:是的 。 绝对是

Earle: But until you use it, I think once you’ve used it for a while, you go, “Why did I waste so much time in the past writing this stuff over and over? I should have just used jQuery.” I think, okay, even if you’re not using jQuery, you need to be using a Library these days. Otherwise, you’re wasting time.

厄尔:但是,除非您使用了它,否则我认为一旦使用了一段时间,您就会走上一条路,“为什么过去我要浪费这么多时间一遍又一遍地写这些东西? 我应该只使用jQuery。” 我认为,好的,即使您不使用jQuery,这些天也需要使用Library。 否则,您会浪费时间。

Kevin: Craig, what annoys you about jQuery?

凯文:克雷格(Craig),您对jQuery感到恼火吗?

Craig: One of my major bugbears at the minute isn’t so much of a problem with the Library itself but the fact that we still have to worry about downloading it. I’d love to see us come to a point where you can tell a browser that you want to add a library to it. So, rather than having to go to a CDN (a content distribution network) to get wider access to the files, the files themselves are available inherently in the browser. So I know when I jump on the train that the library that I was using when I was home on my network is still going to be available to me without having to go in and tweak the code around.

克雷格(Craig):目前 ,我主要的烦恼之一并不是库本身的问题,而是我们仍然需要担心下载它的事实。 我希望看到我们到了可以告诉浏览器您要向其添加库的地步。 因此,不必自己去CDN(内容分发网络)来更广泛地访问文件,而是文件本身就可以在浏览器中使用。 所以我知道,当我坐火车回家时,我在网络上在家时正在使用的图书馆仍然可以使用,而不必去修改代码。

Kevin: Yeah, that’s exciting. Like, there are content delivery networks out there. It would be rare for you to download jQuery and make it a part of your project. Usually these days, you just reference it on the official server but that really makes it difficult to develop when you’re offline.

凯文:是的,这很令人兴奋。 像,那里有内容交付网络。 您很少会下载jQuery并将其纳入项目。 通常这些天,您只在官方服务器上引用它,但这确实使您下线时很难开发。

Craig: Yeah.

克雷格:是的。

Kevin: Hmm, that is annoying. I do want jQuery in my browser.

凯文:嗯,这很烦人。 我确实希望在浏览器中使用jQuery。

Craig: (laughing)

克雷格:(笑)

Kevin: So this book is 400 pages long.

凯文:所以这本书长400页。

Craig: Yeah!

克雷格:是的!

Kevin: And having written a book that size myself, I know what an achievement that is. Congratulations, guys.

凯文:写了一本自己的书,我知道那是什么成就。 恭喜,伙计们。

Craig: Thank you.

克雷格:谢谢。

Earle: Thank you very much.

厄尔:非常感谢。

Kevin: What are some of the things buried in these 400 pages that you guys are most proud of? I thought the below-the-fold plug-in was really impressive.

凯文:你们最引以为豪的这400页书中埋藏着什么? 我认为这种折叠式插件确实给人留下了深刻的印象。

Craig: Thank you.

克雷格:谢谢。

Kevin: Is there anything else like that we should be on the lookout for?

凯文:还有什么需要我们注意的吗?

Craig: One of the things I also got proud of was when John Resig did his WebStock speech, the presentation of it, he was talking about some of the faces of jQuery which have less documentation than others, and I was very pleased to see a lot of the things that Earle and I have made an example of actually was present in John’s speech. So things like the end action, which you’ll come to know and love when you start to use it, it’s poorly documented but it’s in the book and we love it.

Craig: One of the things I also got proud of was when John Resig did his WebStock speech, the presentation of it, he was talking about some of the faces of jQuery which have less documentation than others, and I was very pleased to see a lot of the things that Earle and I have made an example of actually was present in John's speech. So things like the end action, which you'll come to know and love when you start to use it, it's poorly documented but it's in the book and we love it.

Earle: Yeah. I like the last part of the book where we really get into sort of the Ninja-ey stuff and I’m really hoping that there’s people pick it up who’ve never touched jQuery and end up making it to the last chapter and covering it all. That’s what— I think the way we structured the book, I really like. I’d love it if at the end, we’d converted a few non-JavaScripters into loving JavaScript. That’s what I’d like.

Earle: Yeah. I like the last part of the book where we really get into sort of the Ninja-ey stuff and I'm really hoping that there's people pick it up who've never touched jQuery and end up making it to the last chapter and covering it all. That's what— I think the way we structured the book, I really like. I'd love it if at the end, we'd converted a few non-JavaScripters into loving JavaScript. That's what I'd like.

Craig: There’d been some guys at work here and they’ve said “Now I’m really looking for a book that lets them start from the beginning.” And I said, “Well, you’ve got it.” And they said, “Well yeah, but I don’t really know how to use the selectors that well.” And I said, “Well, the book does it.” So I think it’s really good that the book is able to get to an audience that has previously been a bit locked out from access to that level of development.

Craig: There'd been some guys at work here and they've said “Now I'm really looking for a book that lets them start from the beginning.” And I said, “Well, you've got it.” And they said, “Well yeah, but I don't really know how to use the selectors that well.” And I said, “Well, the book does it.” So I think it's really good that the book is able to get to an audience that has previously been a bit locked out from access to that level of development.

Kevin: At the front of this book, you guys went a little romantic with your dedications. This isn’t usually something that I pull out, because dedications can be quite personal. But they’re rarely this personal. Earle, your dedication reads, “For Amelia, I wanted to have a picture here of me holding a boom box above my head but they wouldn’t let me. Will you marry me? Earle.” And I know the day that that got submitted at SitePoint, everyone was talking about it and we thought, “Man, that is quite a lead time for a proposal.” And we felt really bad we couldn’t get the book out in print by Valentine’s Day for you, Earle. But how did it go?

Kevin: At the front of this book, you guys went a little romantic with your dedications. This isn't usually something that I pull out, because dedications can be quite personal. But they're rarely this personal. Earle, your dedication reads, “For Amelia, I wanted to have a picture here of me holding a boom box above my head but they wouldn't let me. 你愿意嫁给我吗? Earle.” And I know the day that that got submitted at SitePoint, everyone was talking about it and we thought, “Man, that is quite a lead time for a proposal.” And we felt really bad we couldn't get the book out in print by Valentine's Day for you, Earle. But how did it go?

Earle: Well, I’m now engaged so that was a—

Earle: Well, I'm now engaged so that was a—

Craig: Woo!

Craig: Woo!

Kevin: Congratulations. Round of applause for Earle. (clapping)

Kevin: Congratulations. Round of applause for Earle. (clapping)

Earle: Yeah, like you said, there was quite a lead time and so you know, I was really just concentrated on holding the relationship together so that…

Earle: Yeah, like you said, there was quite a lead time and so you know, I was really just concentrated on holding the relationship together so that…

Craig: (laughing)

Craig: (laughing)

Kevin: Yeah, we thought, “Oh man, that would be a tough last-minute change to have to make.”

Kevin: Yeah, we thought, “Oh man, that would be a tough last-minute change to have to make.”

Earle: Oh, I’m in the good books now, that’s for sure.

Earle: Oh, I'm in the good books now, that's for sure.

Kevin: Yeah. So tell us the story, what happened?

凯文:是的。 So tell us the story, what happened?

Earle: I’ll probably get in trouble for telling this story, but Amelia, who is my fiancée…

Earle: I'll probably get in trouble for telling this story, but Amelia, who is my fiancée…

Kevin: Yes.

凯文:是的。

Earle: Well because I had no idea when this book was going to land at my hands, I’ve been applying the agile development process here, you know, I already had a few backup plans ready but in the end, it was at a park where she’d been nagging me, “I want to see the book, I want to see the book.” And I’d been putting it off, finally let her do it, and she picked up the book, looked at cover, looked at the back cover and then—I’m thinking, “true lady form”—straight to the dedication! So I didn’t have to— There was no prompting or anything. And I’ve never seen a face change from like a little smile to a confused shock more quickly. Then it was a couple of “really” questions, “Really? Really?” And then it was all happy. She was all smiles.

Earle: Well because I had no idea when this book was going to land at my hands, I've been applying the agile development process here, you know, I already had a few backup plans ready but in the end, it was at a park where she'd been nagging me, “I want to see the book, I want to see the book.” And I'd been putting it off, finally let her do it, and she picked up the book, looked at cover, looked at the back cover and then—I'm thinking, “true lady form”—straight to the dedication! So I didn't have to— There was no prompting or anything. And I've never seen a face change from like a little smile to a confused shock more quickly. Then it was a couple of “really” questions, “Really? Really?” And then it was all happy. She was all smiles.

Kevin: Ah, that’s great.

Kevin: Ah, that's great.

Earle: I had a ring ready to go and everything. That’s some planning right there.

Earle: I had a ring ready to go and everything. That's some planning right there.

Kevin: Well, when it’s in print, you know it must be so. Congratulations, you guys. We’re already planning how we’re going to adjust it for the second print run.

Kevin: Well, when it's in print, you know it must be so. Congratulations, you guys. We're already planning how we're going to adjust it for the second print run.

Earle: Waeeey? That sounds…

Earle: Waeeey? That sounds…

Kevin: You have to put like, “She said yes!” Or something likes that.

Kevin: You have to put like, “She said yes!” Or something likes that.

Earle: Well that’s what she said to me. She said, “Actually, I won’t give you an answer. I’ll let you know in the dedication of my first book.”

Earle: Well that's what she said to me. She said, “Actually, I won't give you an answer. I'll let you know in the dedication of my first book.”

Kevin: (laughing) Youch! Well it’s been great talking to you guys and I look forward to digging in. I’ve read the first couple of chapters but yeah, I am deeply engrossed in this book so looking forward to getting through the rest of it and yeah, I’m happy to hear that it’s not just a clever title. It actually does get to some advanced places at the end. That’s quite an achievement.

Kevin: (laughing) Youch! Well it's been great talking to you guys and I look forward to digging in. I've read the first couple of chapters but yeah, I am deeply engrossed in this book so looking forward to getting through the rest of it and yeah, I'm happy to hear that it's not just a clever title. It actually does get to some advanced places at the end. That's quite an achievement.

Earle: Well, I’d like to hear what you have to say about it when you get to the end.

Earle: Well, I'd like to hear what you have to say about it when you get to the end.

Kevin: All right. Well thanks for joining me guys.

凯文:好的。 Well thanks for joining me guys.

Earle: Thank you.

Earle: Thank you.

Craig: Our pleasure.

Craig: Our pleasure.

Kevin: And look forward to the second edition.

Kevin: And look forward to the second edition.

Both: (laughing)

Both: (laughing)

Kevin: Bye-bye.

Kevin: Bye-bye.

Both: Thanks Kevin.

Both: Thanks Kevin.

Kevin: And thanks for listening to the SitePoint Podcast. If you have any thoughts or questions about today’s interview, please do get in touch.

凯文:感谢您收听SitePoint播客。 如果您对今天的采访有任何想法或疑问,请保持联系。

You can find SitePoint on Twitter @sitepointdotcom, and you can find me on Twitter @sentience.

你可以在Twitter上找到SitePoint @sitepointdotcom ,你可以找到我的Twitter @sentience 。

Visit sitepoint.com/podcast to leave a comment on this show and to subscribe to get every show automatically. We’ll be back next week with another news and commentary show with our usual panel of experts.

访问sitepoint.com/podcast对该节目发表评论并订阅以自动获得每一个节目。 下周我们将与我们通常的专家小组一起再次发布新闻和评论节目。

This episode of the SitePoint Podcast was produced by Karn Broad and I’m Kevin Yank. Bye for now!

This episode of the SitePoint Podcast was produced by Karn Broad and I'm Kevin Yank. 暂时再见!

You can find SitePoint on Twitter @sitepointdotcom.

您可以在Twitter @sitepointdotcom上找到SitePoint 。

Have any thoughts about this interview? Please visit us at sitepoint.com/podcast to leave a comment on this show and to subscribe to receive every show automatically. Email podcast@sitepoint.com if you have any questions for us; we’d love to read them out on the show and give you our advice.

Have any thoughts about this interview? Please visit us at sitepoint.com/podcast to leave a comment on this show and to subscribe to receive every show automatically. Email podcast@sitepoint.com if you have any questions for us; we'd love to read them out on the show and give you our advice.

This episode of the SitePoint Podcast was produced by Karn Broad. Thank you for listening and have a happy, healthy, and successful 2010.

This episode of the SitePoint Podcast was produced by Karn Broad . Thank you for listening and have a happy, healthy, and successful 2010.

Theme music by Mike Mella.

Mike Mella的主题音乐。

Thanks for listening! Feel free to let us know how we’re doing, or to continue the discussion, using the comments field below.

谢谢收听! 欢迎使用下面的评论字段让我们知道我们的状况,或者继续讨论。

翻译自: https://www.sitepoint.com/podcast-50-jquery-novice-to-ninja/

最新回复(0)