From 3440381d2052f10c57fe1699ce58f44bb6c2e4e7 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Sun, 15 Dec 2013 14:06:05 -0500 Subject: [PATCH] for_each_frame: new util, iterates frames with a callback --- modules/utils.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/utils.js b/modules/utils.js index b732636..cef6090 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -355,6 +355,14 @@ queue.prototype = { } }; +function for_each_frame (win, callback) { + callback(win); + if (win.frames && win.frames.length) { + for (var i = 0, n = win.frames.length; i < n; ++i) + for_each_frame(win.frames[i], callback); + } +} + function frame_iterator (root_frame, start_with) { var q = new queue, x; if (start_with) { -- 2.11.4.GIT