Sometimes there is no javascript debugger available on your device or programming environment. Like on a mobile device like iPad (iOS5), which may sport Mobile Safari 5. Still you need a way to inspect your own or the browser's implementation.
Here's how: use the zjrJS cross-browser javascript library.
Instructions Overview
1. Call zjrJS.Debug.crack(), passing a javascript object as its first parameter, catch its return in an array.
2. Filter and sort that array.
3. Echo its contents into a new textarea element.
Requirements
zjrJS.
Copy it to your local device. You can use it as is, or you can atomize it so it includes only the functions you need.
Instructions Detailed
1. Call zjrJS.Debug.crack()
You know which javascript object you want to inspect. In our case, we want to see all properties of the browser's window object.
var allProps = zjrJS.Debug.crack(window);
2. Filter and sort
We may not want all properties. We may want to see events, only. We need to filter.
var allProps = [];
allProps = zjrJS.Debug.crack(window).split("\r");
allProps = allProps.filter(
function (k, i, O) {
return (k.indexOf("on") === 0 || k.indexOf("Event") > -1 );
}
);
(In case your browser doesn't yet have a built-in filter function for arrays, you can add array comprehension to your browser by calling zjrJS.Doc.addArrayComprehension().)
After filtering, the output is a jumbled mess. Few javascript objects sort their properties thematically or alphabetically. Let's do this ourselves:
allProps = allProps.sort();
3. Pour the results into a new textarea element
zjrJS.Doc.aC(
zjrJS.Doc.cT(allProps.join("\r")),
zjrJS.Doc.aC(zjrJS.Doc.cE("textarea"))
);
And done! We've done exactly that in this page. See the textarea below (if javascript is enabled).
Need problem solving?
Talk to me. Let's meet for coffee or over lunch. Mail me at “omegajunior at protonmail dot com”.