top | item 4614546

Chrome DevTools could do that?

514 points| lysol | 13 years ago |igvita.com | reply

74 comments

order
[+] skeletonjelly|13 years ago|reply
Going to make a top level comment about the slide tools.

I just used the Chrome Web Inspector (!) to look at the JS libraries, search for the credited authors of the obviously named file and found this:

https://plus.google.com/118075919496626375791/posts/LG93tTdJ...

Which leads to this:

http://code.google.com/p/io-2012-slides/

Which has this code: http://code.google.com/p/io-2012-slides/source/browse/

And this dog food demo: http://io-2012-slides.googlecode.com/git/template.html

Looks great for doing a talk about code. Has a few features for highlighting code, handling links etc

[+] kevingadd|13 years ago|reply
WARNING: This presentation seems to crash Firefox for me. Had to view it in Chrome. Anyway...

"Disable cache to (re)gain some sanity" because Chrome continues to cache things it shouldn't, including the contents of file:// URLs and in some cases, even content with headers that specify it shouldn't be cached.

mumble grumble

Cool to see some of these features finally documented, though. I had no idea you could drag-drop elements to reorder them.

For those looking to try out the (useful!) Heap Snapshot tool, please be aware that it has a bad habit of crashing tabs. It tends to happen the most when a tab is already using a lot of memory, but sometimes it just happens. So don't do it on a tab that contains any state you might want to hang onto.

One cool feature they don't mention: You can edit code in the script debugger and then hit ctrl+s to update it live in the running page. It's pretty useful for experimenting or for adding tracing points to existing code.

[+] cpeterso|13 years ago|reply
Kevin, thanks for mentioning the Firefox crash. I opened a bug report to track the issue: https://bugzil.la/798244

I bisected the recent Nightly builds and I believe this crash was a regression in Nightly 18.0a1 (2012-09-29). I was not, however, able to reproduce this crash on Aurora 17.0a2 builds. What OS are you running? (I'm running Mac OS X 10.8.)

[+] mnemonik|13 years ago|reply
What release channel of Firefox are you running? I had no problems in Aurora.
[+] moondowner|13 years ago|reply
Works on FF 15.0.1
[+] zaroth|13 years ago|reply
This just goes to show how far we've come, and oh how far we still have to go. For the hackers who live and breathe by these tools, I salute you.

Some products absolutely depend on pushing the envelope of 'what is possible in the browser'. These trailblazers ultimately spend incredible amounts of effort achieving their desired effect, which a year later will be nicely packaged in an MIT-licensed, open source JS lib you can call with a single line of code.

But one look at my feature roadmap tells me exactly when I'll have the time to analyze HAR files, tweak how often I flush packets, stare at paint rectangles, or write some Chrome devtool plugins -- that would be... NEVER.

[+] igrigorik|13 years ago|reply
And that may be just fine for your product. Having said that, I'm a big proponent of treading speed as a feature - evaluate it, quantify it, and prioritize it as such. Then, you may have the time to use these tools :-)
[+] ludwigvan|13 years ago|reply
Here's something that I believe, should be included in dev tools: Click on a node, and see all event handlers that are attached to that node (and those attached using jQuery).

Does anyone know if this is possible using Dev Tools? There is a bookmarklet Visual Event2 (http://www.sprymedia.co.uk/article/Visual+Event+2) that does this, sort of; but it is still lacking.

[+] thezilch|13 years ago|reply
Maybe I'm missing something, but you'll find attached Event Listeners at the very bottom-right of the Elements panel, under where (Computed) Styles, Metrics, Properties, and DOM Breakpoints are found.
[+] masklinn|13 years ago|reply
> Does anyone know if this is possible using Dev Tools?

The WDT puts that in the sidebar of the Elements tab, below Metrics.

These are usually completely unreadable as it's become rather common to 1. use a third-party DOM library (which will add indirections and essentially always bind the same thing) and 2. use delegation (which will bind on a far-removed parent of the element you've selected).

Firebug doesn't (as far as I know) do it natively, but FireQuery[0] adds a display hook to jQuery-bound events (and more), which may provide more and more useful information than the WDT on these (won't work if you're not using jQuery though)

[0] http://firequery.binaryage.com/

[+] xxbondsxx|13 years ago|reply
It's possible, but not trivial. Especially when the developer is using 100% event delegation, you have to run that node against all the potential selectors of parent elements...
[+] wmf|13 years ago|reply
If you're confused by the total lack of UI, try the arrow keys (facepalm?).
[+] adrianpike|13 years ago|reply
To be fair, I'm assuming it's not intended for us to be consuming individually at our discretion, but rather Ilya runs it on our behalf at an event. (Not like it would be hard to add some UI though!)

What really is bugging me though is the antialiasing, is anybody else seeing that?

[+] fletchowns|13 years ago|reply
Spacebar and arrow keys control the slides, just like in every spreadsheet application, ever.
[+] Uhhrrr|13 years ago|reply
I flagged it because in my browser it was as useless as a lead dirigible.
[+] rhengles|13 years ago|reply
I changed the slides by clicking outside of the slides, on the left and right.
[+] primatology|13 years ago|reply
You can also click the black areas to the left and right of the slide.
[+] statictype|13 years ago|reply
Crap, there's a lot of useful stuff in there.

The paint rectangles thing is amazing. I didn't know browsers even expose this data.

The Audit API looks really useful too. I'm now thinking of standardizing on Chrome as the development browser for our team (most devs prefer it anyway) so we can share custom development tool add-ons.

[+] EliAndrewC|13 years ago|reply
Can someone explain TCP Preconnect? My Google-fu has failed me - I understand that DNS prefetching is when Chrome notices that there are links to other domains so it resolves the IP addresses of those domains ahead of time so that their pages will load slightly faster if the user clicks on them. But I'm not clear about TCP preconnecting; are they literally downloading the contents of those pages in advance? Or are they merely opening a connection to the server in case you click on the link so that they'll be able to send the HTTP request slightly faster?

Can someone explain TCP Preconnect? My Google-fu has failed me - I understand that DNS prefetching is when Chrome notices that there are links to other domains so it resolves the IP addresses of those domains ahead of time so that their pages will load slightly faster if the user clicks on them. But I'm not clear about TCP preconnecting; are they literally downloading the contents of those pages in advance? Or are they merely opening a connection to the server in case you click on the link so that they'll be able to send the HTTP request slightly faster?

EDIT: I eventually found a link to http://code.google.com/p/chromium/issues/detail?id=42694 which indicates that Chrome does indeed open connections to servers and doesn't immediately send an HTTP request, leaving those connections open in case we do need to send HTTP requests.

[+] igrigorik|13 years ago|reply
I have a writeup on some of the chrome network internals here: http://www.igvita.com/2012/06/04/chrome-networking-dns-prefe...

As you found in the code above.. the idea is simply to complete the TCP handshake and keep the connection idle until the request is ready to be dispatched. Doing so allows Chrome to shave off one RTT (TCP handshake) of latency.

[+] hadem|13 years ago|reply
The UI for this is terrible. The bullet points are incredibly brief to the point I'm confused about the information it is telling me. How do it actually see the information in the "Sources" pane? It is an overlay but there is no description of how to see it...

Am I missing something?

[+] k3n|13 years ago|reply
Yes, I think you missed the live event where this was used as a deck to go along with a presenter -- which, of course, is notably absent here. I'm fairly certain that those abbreviated bullet points were extrapolated on when the presentation was given live.
[+] quest88|13 years ago|reply
Yes, the audio that went with this presentation.
[+] Ygg2|13 years ago|reply
Yeah, this seems like common confusion. Slides are generally used for the presenter, not the one he presents his stuff.
[+] adgar2|13 years ago|reply
Putting all your information on your slides is the mark of a near-useless presenter. That was middle-school stuff for me.
[+] tech-no-logical|13 years ago|reply
site doesn't work in opera (either regular or opera new).

  Uncaught exception: TypeError: Cannot convert 'document.body' to object
  Error thrown at line 38, column 375 in <anonymous function>() in http://www.igvita.com/slides/2012/devtools-tips-and-tricks/js/slide-deck.js:
    Modernizr.load({test:!!document.body.classList&&!!document.body.dataset,nope:['js/polyfills/classList.min.js','js/polyfills/dataset.min.js'],complete:function(){window.slidedeck=new SlideDeck();}});
  called from line 38, column 181 in http://www.igvita.com/slides/2012/devtools-tips-and-tricks/js/slide-deck.js:
    (function(){Modernizr.load({test:!!document.body.classList&&!!document.body.dataset,nope:['js/polyfills/classList.min.js','js/polyfills/dataset.min.js'],complete:function(){window.slidedeck=new SlideDeck();}});})()
[+] bgrins|13 years ago|reply
Remote debugging is so useful: http://www.igvita.com/slides/2012/devtools-tips-and-tricks/#.... It is painful to try and make and test changes on mobile devices without developer tools.

I wonder when this will be available for iOS.

[+] RandallBrown|13 years ago|reply
You can already do this with Safari (on a mac at least). The dev tools in chrome are just the webkit dev tools (maybe with a few changes) so Safari can do all (almost?) of the same things.
[+] anu_gupta|13 years ago|reply
iOS6 Safari allows remote debugging: you can open a site up on an iDevice and then connect via Safari on the desktop and use Safari's version of Web Inspector
[+] niyazpk|13 years ago|reply
For some reason even after multiple tries over the years I have never been able to get "Break on subtree modifications" and similar to work reliably. I think I must be doing something wrong, but I don't know what. Anybody else have had issues with this?
[+] ljoshua|13 years ago|reply
Great resource, adding on top of other hard-to-find resources that others had pointed out before. (Nice use of a presentation in the browser too.)
[+] molmalo|13 years ago|reply
Can someone explain me this, please:

-Break on subtree modifications - delete me

Thanks!

[+] dhucerbin|13 years ago|reply
On slide 27 [1] it's shown that I can customize colors of Elements pane. It's possible to customize Sources panel? Would be cool to have solarized theme here.

[1] http://www.igvita.com/slides/2012/devtools-tips-and-tricks/#...

[+] antihero|13 years ago|reply
This is exactly what I've been looking for - I'm really interested in helping a friend make some of his slow sites fast, and making some of my own sites even faster. There's so much I didn't understand about the page render process and this helps massively!
[+] mmahemoff|13 years ago|reply
I never noticed the setting to show color "as authored" before. Normally, devtools converts RGB or HSL colors to hex, so you can't copy tweaks back to the source code. Leaving the color alone is how I'll have my devtools now.