From ef143e8586b4bcaf8e454a1653ac4efea9f7906f Mon Sep 17 00:00:00 2001 From: John Nguyen Date: Mon, 12 Dec 2016 07:54:28 -0800 Subject: [PATCH] Fix indentation, use jQuery.each instead of map --- src/featherlight.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/featherlight.js b/src/featherlight.js index ebc511a2..7917c64e 100644 --- a/src/featherlight.js +++ b/src/featherlight.js @@ -66,31 +66,31 @@ 'sandbox', 'src', 'srcdoc', 'width'], attrs = {}; - whiteList.map(function(item) { + $.each(whiteList, function(index, item) { var attrValue = parseAttrs(obj, 'iframe')[item]; if (attrValue) { attrs[item] = attrValue; return attrs[item]; - } + } }); return attrs; } }; -function parseAttrs(obj, prefix) { - var attrs = {}, - regex = new RegExp('^' + prefix + '([A-Z])(.*)'); - for (var key in obj) { - var match = key.match(regex); - if (match) { - var dasherized = (match[1] + match[2].replace(/([A-Z])/g, '-$1')).toLowerCase(); - attrs[dasherized] = obj[key]; + function parseAttrs(obj, prefix) { + var attrs = {}, + regex = new RegExp('^' + prefix + '([A-Z])(.*)'); + for (var key in obj) { + var match = key.match(regex); + if (match) { + var dasherized = (match[1] + match[2].replace(/([A-Z])/g, '-$1')).toLowerCase(); + attrs[dasherized] = obj[key]; + } } + return attrs; } - return attrs; -} /* document wide key handler */ var eventMap = { keyup: 'onKeyUp', resize: 'onResize' };