Permalink
Browse files

Simplify code with forEach for object

  • Loading branch information...
1 parent 915f300 commit dffb5516d1d141d6eab6d5f5deeaa83105d3230c @medikoo committed Aug 18, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/domjs.js
View
@@ -9,6 +9,7 @@ var reserved = require('es5-ext/lib/reserved').all
, bindMethods = require('es5-ext/lib/Object/bind-methods').call
, link = require('es5-ext/lib/Object/plain/link').bind
, isPlainObject = require('es5-ext/lib/Object/plain/is-plain-object').call
+ , oForEach = require('es5-ext/lib/Object/plain/for-each').call
, renameReserved, nodeMap, nextInit;
@@ -98,8 +99,8 @@ Object.freeze(module.exports = {
},
updateElement: function (el, data) {
var attrs = data[0], children = data[1];
- Object.keys(attrs).forEach(function (name) {
- this.setAttribute(el, name, attrs[name]);
+ oForEach(attrs, function (value, name) {
+ this.setAttribute(el, name, value);
}, this);
children.forEach(function (child) {
if (typeof child === "string") {

0 comments on commit dffb551

Please sign in to comment.