I'm busy hacking a template from an existing source to fit into a new Cake backend. The template is pretty well written but I need to update the way in which content is being loaded and displayed. Currently the site loads the *entire* site into one page and then flipping the visibility of elements in order to simulate dynamic loading. Of course this works fine for the demo site the template loads, but is not going to fly for a production site.
I ran into the problem of having to work out where the event handlers are being declared for various elements on the page. I was faced with the task of trekking through 15 files of Javascript. Okay some are obviously not candidates (like jQuery.js itself) but that's still a mission.
Luckily jQuery has an extra bit of goodness that made the task trivial. It stores event handlers in the data attribute (read up about that here http://api.jquery.com/jQuery.data/ ).
Using Firebug you can open your console tab and bash in the magic command:
$('#sneakybatmachine').data('events');
replacing the element selector with something more likely to match in your document.
That will give you a nice interactive way to explore the element and all of it's handlers, letting you click through right to the point in script where the handler is defined.
This saves lots of time having to RTFS.
Subscribe to:
Post Comments (Atom)
-
Azure Active Directory is a great product and is invaluable in the enterprise space. In this article we'll be setting it up to provide ...
-
While debugging and setting up Puppet I am still running the agent and master from CLI in --no-daemonize mode. I kept getting an error on...
-
I was looking around for a way to generate a word of the day on the web and didn't find anything. So I coded a quick and dirty script t...
No comments:
Post a Comment
Note: only a member of this blog may post a comment.